//检查返回值,以确保已成功地连接到了Excel
if
excelok<>
0
then
messagebox("信息提示","连接EXCEL失败,请检查计算机中是否安装了EXCEL!")
return
-1
//"Excel文件(*.xls),*.xls"
end
if
li_net
=
GetFileOpenName("选择文件",
str_savename,named,"xls","EXCEL (*.XLS;*.XLSX),*.XLS;*.XLSX")
if
li_net
>
0
then
if
str_savename
=
""
then
return
-1
dw_1.settransobject(sqlca)
dw_1.reset()
excelserver.workbooks.open(str_savename)
excelserver.activesheet.cells.copy
li_count
=
dw_1.importclipboard(2) //导入数据
clipboard("")
excelserver.quit()
excelserver.disconnectobject()
messagebox('提示','读取成功')
destroy
excelserver
return
1
else
messagebox('信息提示','没有指定导入文件!')
return
-1
end
if