+ Reply to Thread
Results 1 to 6 of 6

Late Binding ADODB.Connection and using OpenSchema

  1. #1
    Registered User
    Join Date
    06-14-2013
    Location
    Australia
    MS-Off Ver
    2007/2013/2016
    Posts
    14

    Late Binding ADODB.Connection and using OpenSchema

    Hi All,

    I cannot find a solution for this.

    How can I use late binding to create an ADODB.Connection object and use cn.OpenSchema as OpenSchema does not work unless I use Early Binding and reference ActiveX Data Objects (which is not possible to reference this in my environment due to restrictions).

    Please Login or Register  to view this content.
    When I try to run this it debugs on Cn.OpenSchema because it doesn't know what OpenSchema is since the connection object was late binded.
    When I change this and use early binding it all works.
    Last edited by Leith Ross; 12-09-2016 at 09:37 PM. Reason: Added Code Tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Late Binding ADODB.Connection and using OpenSchema

    What are you connecting to?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Late Binding ADODB.Connection and using OpenSchema

    Hi,

    Did you actually declare the adSchemaTables as mentioned in the code? If you didn't, you must add this line
    Please Login or Register  to view this content.
    below your declaration lines.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Registered User
    Join Date
    06-14-2013
    Location
    Australia
    MS-Off Ver
    2007/2013/2016
    Posts
    14

    Re: Late Binding ADODB.Connection and using OpenSchema

    Quote Originally Posted by Norie View Post
    What are you connecting to?
    Hi Norie. I am connecting to an .accdb file

  5. #5
    Registered User
    Join Date
    06-14-2013
    Location
    Australia
    MS-Off Ver
    2007/2013/2016
    Posts
    14

    Re: Late Binding ADODB.Connection and using OpenSchema

    Quote Originally Posted by xlnitwit View Post
    Hi,

    Did you actually declare the adSchemaTables as mentioned in the code? If you didn't, you must add this line
    Please Login or Register  to view this content.
    below your declaration lines.
    Hi xlnitwit. I did some further playing yesterday (at work) and declared adSchemaTables as you mentioned.
    It started working but then I realized I still had the references to ActiveX Data Objects so I removed those, and tried again and it was still working.

    I will try again on Monday to see if the late binding is working and will report back here the results.

  6. #6
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Late Binding ADODB.Connection and using OpenSchema

    Quote Originally Posted by xlnitwit View Post
    Hi,

    Did you actually declare the adSchemaTables as mentioned in the code? If you didn't, you must add this line
    Please Login or Register  to view this content.
    below your declaration lines.
    Someone else's post. But the solution given by xlnitwit helped me a lot. I was struggling for the last two days with a Rob Bovey's code to get list of sheets from a closed file.
    Teach me Excel VBA

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] What are early binding and late binding?
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2015, 02:33 AM
  2. [SOLVED] Learning differences between Early Binding & Late Binding
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-28-2013, 01:16 AM
  3. [SOLVED] Seeking knowledge on Early Binding, Late Binding
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-17-2013, 10:45 PM
  4. New to Late Binding in VBA -- Would appreciate Help.
    By d0Tork0b in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2013, 01:46 PM
  5. Conversion from early binding to late binding
    By bettingman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2011, 04:10 AM
  6. Late Binding
    By energizek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2009, 03:41 AM
  7. Late Binding examples of binding excel application
    By HeatherO in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-17-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1