Excel VBA: Late binding reference

前端 未结 1 1392
时光说笑
时光说笑 2021-01-21 11:12

I\'m trying to write some code for an add-in in excel, which grabs some data from an SQL Server. The code itself is working flawlessly, but somehow something got corrupted.

相关标签:
1条回答
  • 2021-01-21 11:55

    In answer to your question about late binding, this involves replacing the line of code

    Dim Connection As ADODB.Connection
    

    with

    Dim Connection As object
    

    and replacing

    Set Connection = New ADODB.Connection
    

    with

    Set Connection = GetObject(, "ADODB.Connection")
    

    And similarly for the other objects from that library.

    Now, I am not sure if this will fix the actual issue that you are having. It sounds like there is a bug in the ActiveX library and you are hitting it, although nothing you are doing seems particularly esoteric.

    0 讨论(0)
提交回复
热议问题