Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REferencing to a Type Library 1

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
The help files dont seem to help, but is there anyway...through code...to make a Reference to "Microsoft Visual Basic for Applications Extensiblity 5.3" Library. I wouldn't want to go to each machine using my code and manually setting the Reference. Thanks
 
Hi Luis939,

You should probably check if it's already there first - but you can trap the error if you don't. Anyway, this should add it if it's not already there ..

Code:
[blue]ActiveWorkbook.VBProject.References.AddFromFile "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"[/blue]

I think it's reasonable to hard code this path in most circumstances, but am not an expert in this area.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
UU very nice....actually just before you responded I was able to rearrange my code so that I wouldn't have to make that reference....the only weird thing i cant explain is that although the code works, i cannot specify the declaration I want
Dim VBComp as VBComponents...gives me an error
however, when i say,
MsgBox TypeName(VBComp), it does say VBComponents,
so thanks, Ill defintely see if i can use your response if i defintely need to reference another library.
 
Luis939 - Perhaps to shed some light on the weirdness. In order to Dim VBComp as VBComponents, the Extensibility objects have to be included in the project because they are needed at compile time. This is part of what is known Early Binding.

However, as long as the library has been installed and properly registered at on the target machine, they can be found at run-time. This is part of what is known as Late-Binding.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
have a look @ this link which may help you out in referencing...........


Ivan F Moala
xcelsmall.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top