vb 导出excel 问题 !
一个以前同事写的代码是VB导出到EXCEL,运行该代码是否需要加载什么 ??谢谢!
ExportAllView as string
ExportAllView = "[Excel 8.0;DATABASE=C:\TEMP\AllView.XLS].[AllView]"
strSQL = "SELECT * into " & ExportAllView & _
"FROM itemmstr " & _
"WHERE (Acc_FG=1 AND MRP_FG=1 AND pur_FG=1 AND qm_FG=1 AND export_fg=0)" & _
" or (ITEM_GRP='299' AND ITEM_NO<>'' AND export_fg=0 )" & _
" or (ITEM_GRP='599' AND ITEM_NO<>'' AND export_fg=0 and MRP_FG=1 AND pur_FG=1 AND acc_FG=1 )" & _
" or (ITEM_GRP='600' AND ITEM_NO<>'' AND export_fg=0 and MRP_FG=1 AND pur_FG=1 AND acc_FG=1 )"
cn.Execute (strSQL)
实现该操作是否需要加载??了解的指导下!谢谢!!
--------------------编程问答-------------------- 引用 ado对象,excel 11.0对对象
dim cn as adodb.connection
--------------------编程问答-------------------- 这是个老问题了,csdn里搜一下会有好多 --------------------编程问答-------------------- 只引用 ado就行 --------------------编程问答--------------------
Public cn As New ADODB.Connection
我吧语句直接在查询分析器里执行的时候他提示错误 !
Specified owner name 'Excel 8.0;DATABASE=C:\TEMP\AllView.XLS' either does not exist or you do not have permission to use it.
sql:
SELECT * into [Excel 8.0;DATABASE=C:\TEMP\AllView.XLS].[AllView]
FROM itemmstr
WHERE (Acc_FG=1 AND MRP_FG=1 AND pur_FG=1 AND qm_FG=1 AND export_fg=0)
or (ITEM_GRP='299' AND ITEM_NO<>'' AND export_fg=0 )
or (ITEM_GRP='599' AND ITEM_NO<>'' AND export_fg=0 and MRP_FG=1 AND pur_FG=1 AND acc_FG=1 )
or (ITEM_GRP='600' AND ITEM_NO<>'' AND export_fg=0 and MRP_FG=1 AND pur_FG=1 AND acc_FG=1 )
补充:VB , 基础类