VBA reference via code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Is it possible to add a VBA reference via VBA code.
For example I will need to check when the spreadsheet open if ADO reference
is setup, and if not set up to set it up.
Thanks.
Mark
 
Mark,

Try something like

On Error Resume Next
ThisWorkbook.VBProject.References.AddFromGuid _
GUID:="{B691E011-1797-432E-907A-4D8C69339129}", major:=0, minor:=0

See also www.cpearson.com/excel/vbe.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top