pb中调excel的宏

zengguochao1980 2004-03-04 10:53:40
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=hdqt;SRVR=hdqt_db;UID=DBUSRHQ;PWD=futurehq", Destination:=Range( _
"A1"))
.CommandText = Array( _
"SELECT BANK_CARDZY.CDZCODE, BANK_CARDZY.CDZNAME, BANK_CARDZY.CDZMEMO, BANK_CARDZY.CDZFLAG" & Chr(13) & "" & Chr(10) & "FROM DBUSRHQ.BANK_CARDZY BANK_CARDZY" & Chr(13) & "" & Chr(10) & "ORDER BY BANK_CARDZY.CDZCODE" _
)
.Name = "查询来自 hdqt"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

上面这段代码怎样在pb中实现?已建立了ole连接如下:
ExcelServer = CREATE OLEObject
li_ret = ExcelServer.ConnectToNewObject( "excel.application" )
IF li_ret<>0 THEN
MessageBox('OLE错误','OLE无法连接!错误号:' + string(li_ret))
return -1
END IF
...全文
90 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

相关推荐
发帖
PowerBuilder
创建于2007-09-28

866

社区成员

PowerBuilder 相关问题讨论
申请成为版主
帖子事件
创建了帖子
2004-03-04 10:53
社区公告
暂无公告