View Single Post
 
Old 04-21-2014, 05:29 AM
chamdan chamdan is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Nov 2013
Posts: 13
chamdan is on a distinguished road
Thumbs up Solved- Microsoft Excel 12.0 Object Library reference upload

I have finally resolved this issue of uploading programmatically the reference to Excel 12.0 Object library from ms project vba.
Here below is the solution:
Call the first macro from inside the Open_Event and one from the before_Close_Event.

First macro:

HTML Code:
Public Sub addRefToOffice()
  On Error Resume Next
  Application.VBE.ActiveVBProject.References.AddFromFile "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE"
End Sub
Second macro:

HTML Code:
Public Sub removeRefToOffice()
  Dim ref As Object
  On Error Resume Next
  Set ref = Application.VBE.ActiveVBProject.References("Excel")
  Application.VBE.ActiveVBProject.References.Remove ref
End Sub
Chuck
Reply With Quote