求助!定义了个ole,链接不上,报错
在窗口open事件写如下代码:
ole_1 ole_object
Integer li_ret,li_rtn
ole_object = CREATE ole_1
li_ret = ole_object.ConnectToObject("","Excel.Application")
IF li_ret <> 0 THEN
/*--如果Excel还没有打开则新建--*/
li_ret = ole_object.ConnectToNewObject("Excel.Application")
if li_ret <> 0 then
MessageBox('OLE错误','OLE无法连接!错误号:' + string(li_ret))
li_rtn = -1
end if
ole_object.Visible = False //一般自动保存时设为不可视
END IF
然后报错:
error:c0051:unknown function name: connecttoobject
error:c0051:unknown function name: connecttonewobject
[解决办法]
ole_1是什么东西
应该是
oleobject ole_object
ole_object = craete oleobject
if ole_object.connecttonewobject("excel.application") <> 0 then
//无法连接ole
end if