关于excel导入到数据窗口的问题,在线急等.谢谢

xiaoduoliu 2003-11-21 01:52:09
在导入时出现这样的错误提示:
application terminated.
error:error calling external object function opne at line 14 in clicked event of object cb_1 of w_main.


请问这是为什么呀?代码是这样的:
OLEObject ExcelServer
ExcelServer = CREATE OLEObject
int excelok
string str_savename
string str_filename
long value

ExcelOK = ExcelServer.ConnectToNewObject( "excel.sheet" )
if excelok <> 0 then
messagebox("连接excel失败,检查你的系统是否安装了office",string(excelok))
return
else
if sle_1.text<>"" then
str_filename=sle_1.text
ExcelServer.application.Workbooks.Open(str_filename)
str_savename="e:\temp.txt"
excelserver.activeworkbook.saveas(str_savename,3)
excelserver.displayalerts=false
ExcelServer.quit()
ExcelServer.DisconnectObject()
DESTROY ExcelServer
value=dw_1.importfile(str_savename)
if value=0 then messagebox(" error","End of file; too many rows")
if value =-1 then messagebox(" error","No rows")
if value=-2 then messagebox(" error"," Empty file")
if value=-3 then messagebox(" error"," Invalid argument")
if value=-4 then messagebox(" error","Invalid input")
if value=-5 then messagebox(" error","Could not open the file")
if value=-6 then messagebox(" error","Could not close the file")
if value=-7 then messagebox(" error"," Error reading the text")
if value=-8 then messagebox(" error","Not a TXT file")
if value=-9 then messagebox(" error","The user canceled the import")
if value=-10 then messagebox(" error","Unsupported dBase file format (not version 2 or 3)")
filedelete(str_savename)
return
else
sle_1.text="请先选择您要导入的文件!"
sle_1.textcolor=16711680
end if
end if
...全文
87 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
motoc 2003-11-21
  • 打赏
  • 举报
回复
用自由风格的Datawindow
bomber2001 2003-11-21
  • 打赏
  • 举报
回复
查看VBA看看,
xiaoduo 2003-11-21
  • 打赏
  • 举报
回复
怎么没有人答复呢?我是不会 我推荐朋友来的 大家帮帮忙嘛 分数不够可以再加!

740

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧