1,085
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
```c++
ExcelServer = CREATE OLEObject
ExcelOK = ExcelServer.ConnectToNewObject( "excel.application" )
if excelok < 0 then
// messagebox("连接excel失败,检查你的系统是否安装了office",string(excelok))
// return(-1)
ExcelOK = ExcelServer.ConnectToNewObject( "et.application" )
if excelok < 0 then
ExcelOK = ExcelServer.ConnectToNewObject( "ket.application" )
if excelok < 0 then
messagebox("连接excel和et都失败了,请检查你的系统,至少安装office或wps企业版中的一种办公软件。",string(excelok))
return(-1)
end if
end if
end if
```
差不多吧,connection链接时excel换成wps,应该可以了,也可以去wps网站上去问问。