使用freebasic写了一个获取excel版本号的代码。fb通过disphelper库可以很方便使用com组件。代码如下给free basic使用者参考一下:
#include "disphelper/disphelper.bi"
DISPATCH_OBJ(xlapp)
dhInitialize(TRUE)
dhToggleExceptions(TRUE)
dhCreateObject("excel.application", NULL, @xlapp)
dim as zstring ptr xlversion
dhGetValue("%s", @xlversion,xlapp, ".Version")
dhCallMethod(xlapp, ".Quit")
print "excel version: "; *xlversion
dhFreeString(xlversion)
SAFE_RELEASE(xlapp)
dhUninitialize(TRUE)
sleep
运行结果可见:

浙公网安备 33010602011771号