+ Reply to Thread
Results 1 to 6 of 6

Line of Code to set references

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267

    Line of Code to set references

    Suppose I wish to set reference to "Micosoft Visual Basic for Extensibility5.0". How do I accomplish this programmatically?

    TIA

    Myles

  2. #2
    Tom Ogilvy
    Guest

    Re: Line of Code to set references

    http://support.microsoft.com/kb/160647/en-us
    XL97: How to Programmatically Create a Reference

    set a reference manually and then query it for the file

    ? thisworkbook.VBProject.References("vbide").FULLPATH
    C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBEEXT1.OLB

    FOR EXAMPLE

    or try the GUID

    ? thisworkbook.VBProject.References("vbide").Guid
    {0002E157-0000-0000-C000-000000000046}
    possibly.

    This was from Excel 97, so try it in your version.

    --
    regards,
    Tom Ogilvy



    "Myles" <Myles.25o4im_1144033802.5836@excelforum-nospam.com> wrote in
    message news:Myles.25o4im_1144033802.5836@excelforum-nospam.com...
    >
    > Suppose I wish to set reference to "Micosoft Visual Basic for
    > Extensibility5.0". How do I accomplish this programmatically?
    >
    > TIA
    >
    > Myles
    >
    >
    > --
    > Myles
    > ------------------------------------------------------------------------
    > Myles's Profile:

    http://www.excelforum.com/member.php...o&userid=28746
    > View this thread: http://www.excelforum.com/showthread...hreadid=529064
    >




  3. #3
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267
    Thanks Tom for the lead. It does help in setting reference to a WorkBook and from what I gleaned from the link, I tried the following line for settting the reference to "Microsoft Visual Basic for Applications Extensibility 5.3" and came up with "Method VBE of object_Application failed" error.

    Set x = Application.VBE.ActiveVBProject _
    .References("Microsoft Visual Basic for Applications Extensibility 5.3")

    Myles.

  4. #4
    Chip Pearson
    Guest

    Re: Line of Code to set references

    You need to use the name of the Extensibility project

    Set x = Application.VBE.ActiveVBProject.References("VBIDE")


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Myles" <Myles.25pzez_1144120502.0949@excelforum-nospam.com>
    wrote in message
    news:Myles.25pzez_1144120502.0949@excelforum-nospam.com...
    >
    > Thanks Tom for the lead. It does help in setting reference to a
    > WorkBook
    > and from what I gleaned from the link, I tried the following
    > line for
    > settting the reference to "Microsoft Visual Basic for
    > Applications
    > Extensibility 5.3" and came up with "Method VBE of
    > object_Application
    > failed" error.
    >
    > Set x = Application.VBE.ActiveVBProject _
    > References("Microsoft Visual Basic for Applications
    > Extensibility 5.3")
    >
    > Myles.
    >
    >
    > --
    > Myles
    > ------------------------------------------------------------------------
    > Myles's Profile:
    > http://www.excelforum.com/member.php...o&userid=28746
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=529064
    >




  5. #5
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267
    Chip,

    I am a bit at sea here. I need the line of code to set the reference to "Microsoft Visual Basic for Applications Extensibility 5.3" programmatically and with the same effect as the manual approach ie the requisite checkbox in the Reference dialogbox becomes ticked.
    Set x = Application.VBE.ActiveVBProject.References("VBIDE" ) fails to achieve that.

    Myles.

  6. #6
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267
    I have had some visitation from Gurus Tom & Chip but am still not able to get what I want. Namely, the code-quivalent of manually settting VBE reference to "Microsoft Visual Basic for Applications Extensibility 5.3" or "SOLVER" for that matter.

    Thanks for any help.


    Myles

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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