【问题标题】:Excel - VBA CopyFromRecordset Field limit 256Excel - VBA CopyFromRecordset 字段限制 256
【发布时间】:2021-02-05 19:25:57
【问题描述】:

我正在尝试通过 ADO 将一些 excel xlsx 文件中的数据复制到我的 excel 文件中。数据文件有282列,但我刚刚发现字段的限制最多只能达到256。

有人知道是否有办法扩大这个限制吗?

以防万一我使用的是 Office 365。下面的部分代码:

    MyConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
                         SourceFile & _
                        ";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
                        
    Set MyCon = CreateObject("ADODB.Connection")
    MyCon.Open ConnectionString:=MyConnectionString
    
    Set MyRecordset = CreateObject("ADODB.RecordSet")
 
    i = 6
    For Each Ticker In TickerArray
        SQLString = "SELECT * FROM [Dashboard$A:JV] where Símbolo = '" & Ticker & "'"
        
        MyRecordset.Open Source:=SQLString, _
                         ActiveConnection:=MyCon, _
                         CursorType:=adOpenKeyset, _
                         Options:=adCmdText

       Debug.Print MyRecordset.Fields.Count

Debug.Print 结果 MyRecordset.Fields.Count = 255

提前致谢

【问题讨论】:

标签: sql excel ado


【解决方案1】:

行也存在同样的问题。我有一个具有 > 350 个度量的 Power Pivot 模型。当我运行 Bertrand d'Arbonneau 的其他出色的 Power Pivot Utilities 时,CopyFromRecordset 行仅复制前 256 个小节。

【讨论】:

    【解决方案2】:

    Microsoft.ACE.OLEDB 提供程序具有 255 个字段的内置限制。

    【讨论】:

    • 提供描述限制的文档链接会很有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-21
    • 2013-07-09
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多