How to programatically add a reference to a module in global.mpt?

R

Rick Henry

I have a VBA module with a reference to Microsoft XML, v5.0. In the
Project_Open event handler I use the OrganizerMoveItem method to copy this
module into GLOBAL.MPT. However, the reference is not copied with the module.
Does anyone know how to programatically set the reference in the module in
GLOBAL.MPT?
 
J

John

Rick Henry said:
I have a VBA module with a reference to Microsoft XML, v5.0. In the
Project_Open event handler I use the OrganizerMoveItem method to copy this
module into GLOBAL.MPT. However, the reference is not copied with the module.
Does anyone know how to programatically set the reference in the module in
GLOBAL.MPT?

Rick,
I did it some years ago in an auto_open macro using the following code:
Sub auto_open()
'Set up a reference to the Excel object library
Application.VBE.ActiveVBProject.References.AddFromguid
"{00020813-0000-0000-C000-000000000046}", 1, 2
End Sub

However I haven't tried it using the open Event available in today's
object library.

Hope this helps.
John
Project MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top