【发布时间】:2020-09-18 15:50:39
【问题描述】:
我试图在ListObject 中显示一条SQL 语句的结果。 SQL 语句选择的数据位于 MS-Access 表中,并包含数据类型为 guid 的列。
ListObject 对象是这样创建的
set listObj = activeSheet.listObjects.add( _
sourceType := xlSrcExternal , _
source := array(source) , _
destination := destCell)
source 是一个值为OLEDB;provider=Microsoft.ACE.OLEDB.12.0;data source=p:\ath\do\db.accdb 的字符串。
我这样执行select语句
with listObj ' {
.displayName = "foo"
with .queryTable ' {
.commandType = xlCmdSql
.commandText = array("select * from tab")
.refreshOnFileOpen = false
.backgroundQuery = true
.refreshStyle = xlInsertDeleteCells
.saveData = true
.refreshPeriod = 0
.preserveColumnInfo = true
.refresh backgroundQuery := false
end with ' }
end with ' }
这会显示查询的结果集,但没有包含 guid 的列。
那么,有没有办法添加 guid 列?
【问题讨论】:
-
这段代码是什么语言?那不是 VBA。
-
哦,好吧,我现在看到那些撇号了。奇数。
-
撇号在 VBA 中开始 cmets..
-
我知道他们有,奇怪的是大括号。
-
大括号用于代码折叠。