Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-20-2014, 10:29 PM
chamdan chamdan is offline Microsoft Excel 12.0 Object Library reference upload Windows 7 32bit Microsoft Excel 12.0 Object Library reference upload Office 2007
Novice
Microsoft Excel 12.0 Object Library reference upload
 
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
  #2  
Old 04-21-2014, 05:29 AM
chamdan chamdan is offline Microsoft Excel 12.0 Object Library reference upload Windows 7 32bit Microsoft Excel 12.0 Object Library reference upload Office 2007
Novice
Microsoft Excel 12.0 Object Library reference upload
 
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
  #3  
Old 04-21-2014, 06:30 AM
JulieS JulieS is offline Microsoft Excel 12.0 Object Library reference upload Windows 7 64bit Microsoft Excel 12.0 Object Library reference upload Office 2013
Expert
 
Join Date: Dec 2011
Location: New England
Posts: 1,693
JulieS will become famous soon enough
Default

Glad you were able to solve it and thanks very much for posting the answer!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft office upload center msosync.exe q_auth6 Office 5 11-26-2013 02:49 PM
Microsoft Excel 12.0 Object Library reference upload Excel VBA: How to add a reference to Microsoft Word Object Library? tinfanide Excel Programming 7 12-12-2011 05:21 AM
option Paste special...as 'Microsoft Excel Chart Object' NOT available Intruder PowerPoint 0 12-24-2010 06:28 AM
Problem: object library invalid or contains references to object definitions aligahk06 Office 0 08-19-2010 12:29 PM
Access Object library 10 Gyto Office 0 10-09-2008 09:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft