+ Reply to Thread
Results 1 to 3 of 3

Determine if there is a library referenced in VBA code

  1. #1
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Determine if there is a library referenced in VBA code

    I would like to use early binding for dictionary objects if the Microsoft Scripting Runtime library is referenced; however, if my macro runs on a machine that did not reference the library, I would like to use late-binding.

    For example, I would like to do something like this:
    Please Login or Register  to view this content.
    I know that will not work because the declarations are made before the If-Else statement runs, but is there any way to accomplish what I want to do (conceptually) above?

    I think it would make solving Forum member's solutions easier because it would allow me to take advantage of the intellesense list of a dictionary object without changing the code for solutions I post in the forum. And I'd learn more about VBA if I could determine which libraries are referenced in VBA.
    <---If my answer helped, please click *

  2. #2
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Determine if there is a library referenced in VBA code

    Hi,

    Great Idea. I don't think you will be able to find an acceptable solution.

    I offer the following poor man's alternative using CONDITIONAL COMPILATION:
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: Determine if there is a library referenced in VBA code

    INTERESTING!!!

    I had no idea what a preprocessor command was before I delved into your solution. That is exactly what I was looking for, Lewis! That allows me to use the intellesense list, which makes me feel all warm and fuzzy as I code since I'm still developing my object-orientated skills. I don't want to have to keep giving novice forum users instructions on how to reference a library because it will confuse many people.

    Once again, thank you very much!!!
    Last edited by joe31623; 02-02-2016 at 09:53 PM.

+ 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. How to build a code library and include it in projects?
    By XmisterIS in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-05-2014, 10:19 AM
  2. Can't find project or library - MS Forms 2.0 Ojbect Library
    By RTSmith in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-11-2012, 06:51 PM
  3. Need code to run when value referenced changes
    By DTUchange in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2011, 10:08 PM
  4. Need additional code to load object library
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2011, 11:03 AM
  5. Run Add-In code when Add-In is referenced
    By JamieMcLeod in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-01-2010, 06:53 AM
  6. Does library reference stay with the code?
    By Peter Cornish in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2006, 11:20 AM
  7. [SOLVED] Code to fix: 'can't find project or library'
    By EWR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2005, 03: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