ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Line of Code to set references (https://www.excelbanter.com/excel-programming/357816-line-code-set-references.html)

Myles[_60_]

Line of Code to set references
 

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

TIA

Myle

--
Myle
-----------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...fo&userid=2874
View this thread: http://www.excelforum.com/showthread.php?threadid=52906


Tom Ogilvy

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").FULLPAT H
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" wrote in
message ...

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




Myles[_62_]

Line of Code to set references
 

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


Chip Pearson

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"
wrote in message
...

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




Myles[_63_]

Line of Code to set references
 

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.


--
Myles
------------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...o&userid=28746
View this thread: http://www.excelforum.com/showthread...hreadid=529064


Myles[_64_]

Line of Code to set references
 

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


--
Myles
------------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...o&userid=28746
View this thread: http://www.excelforum.com/showthread...hreadid=529064



All times are GMT +1. The time now is 07:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com