![]() |
Programmatically Add Reference`
Hi,
Here is a code that I saw on the web that was use to load ADO lib. I kept it in case but I never try it. Change it for the lib you're looking for. Sub Activate_ADORef_IfMissing() Dim vbpRef As Object Dim i As Integer, r As Integer Dim Ref As String, refFile As String Set vbpRef = ThisWorkbook.VBProject.References Ref = "*ActiveX Data Objects 2.*" refFile = "C:\Program Files\Common Files\System\ado\msado15.dll" ' ADO 2.7 On Error Resume Next For i = 1 To vbpRef.Count If vbpRef.Item(i).Description Like Ref Then Exit Sub Next vbpRef.AddFromFile refFile End Sub Let me know if it works. -- JP http://www.solutionsvba.com "JohnV" wrote in message ... I have a spreadsheet that will be used by different Admins. As they have varying levels of technical knowledge I would like to be able to check the references when the workbook is opened and see if the references to "Microsoft Outlook X.X Library" is checked. As the users can be using Office 97, 2000 or XP and I am not sure exactly what reference I am looking for; I probably need to check for all 3. Additionally, I am not sure where the reference library would be kept, so I would like to refer to the Library name rather than the location. Could anybody help me with this? Thanks, JohnV |
All times are GMT +1. The time now is 08:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com