ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA reference via code (https://www.excelbanter.com/excel-programming/391452-vba-reference-via-code.html)

Mark

VBA reference via code
 
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

Chip Pearson

VBA reference via code
 
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)



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




All times are GMT +1. The time now is 01:35 PM.

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