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)
 
Back
Top