Query Tables (QueryTables) in Excel 2010 with VBA with VBA creating many connections

前端 未结 8 717
北荒
北荒 2021-02-06 12:49

I\'m following code I found on another site. Here\'s the basics of my code:

Dim SQL As String
Dim connString As String

connString = \"ODBC;DSN=DB01;UID=;PWD=;Da         


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 13:24

    Try setting the QueryTable.MaintainConnection property to False...

    "Set MaintainConnection to True if the connection to the specified data source is to be maintained after the refresh and until the workbook is closed. The default value is True! And there doesn't seem to be a UI check box for this (Read/write Boolean)"

提交回复
热议问题