View Single Post
 
Old 04-20-2014, 10:29 PM
chamdan chamdan is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Nov 2013
Posts: 13
chamdan is on a distinguished road
Default Microsoft Excel 12.0 Object Library reference upload

Hi,

Does anyone out there know how to add the reference library listed above using vba from inside ms project and remove the before closing.

I tried the following but seems not to work:
HTML Code:
Public Sub addRefToOffice()
  On Error Resume Next
  Application.VBE.ActiveVBProject.References.AddFromFile "C:\Program Files\Microsoft Office\Office12\MSO12.DLL"
End Sub
HTML Code:
Public Sub removeRefToOffice()
  Dim ref As Object
  On Error Resume Next
  Set ref = Application.VBE.ActiveVBProject.References("C:\Program Files\Microsoft Office\Office12\MSO12.DLL")
  Application.VBE.ActiveVBProject.References.Remove ref
End Sub
I look forward to hearing from someone.

Regards,

Chuck
Reply With Quote