PDA

View Full Version : How to add References to a VBA Project?



gopi09_m
04-24-2008, 09:47 PM
Hi,

I am new to Excel VBA.I have a requirement where i should add the References to a VBA Project programmatically.

Is that possible do it using code?

Regards,
Krrishna

herzberg
04-24-2008, 10:24 PM
It's possible. Check out these 2 articles in the KB:

Adding a reference
http://vbaexpress.com/kb/getarticle.php?kb_id=267

How to identify a reference
http://vbaexpress.com/kb/getarticle.php?kb_id=278

I found them to be of great help when I had the same problem as you previously.

gopi09_m
04-25-2008, 08:07 PM
Hi,

when i run the above code its throwing a runtime error "can't break continue mode".

How can we rectify this?I have used the same code you have given to me.

Regards,
Krrishna

Simon Lloyd
04-25-2008, 08:44 PM
You cannot step through the code and you will probably need Microsoft Extensibility Library reference setting and usually you need to have trusted access to the vba project.