Excel Library Reference

M

MichaelA

Hello All,

Is there a way of selecing the Excel Reference Library using VBA
allowing users to run macros that use Excel without having them go
into the VBA editor and selecting the library manually, which could
lead to all sorts of problems.

Thanks and regards
Michael A.
 
R

Rod Gill

Hi,

The following works on my PC, but I'm not sure if it works as is on other
PCs. Please let us know if it works for you!

For Excel 2007:
activeproject.VBProject.References.AddFromGuid
"{00020813-0000-0000-C000-000000000046}",1,6

For Excel 2003:
activeproject.VBProject.References.AddFromGuid
"{00020813-0000-0000-C000-000000000046}",1,5
--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com




MichaelA said:
Hello All,

Is there a way of selecing the Excel Reference Library using VBA
allowing users to run macros that use Excel without having them go
into the VBA editor and selecting the library manually, which could
lead to all sorts of problems.

Thanks and regards
Michael A.


__________ Information from ESET Smart Security, version of virus
signature database 4462 (20090927) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4462 (20090927) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
M

MichaelA

Rod,

This works for the current project. It seems there isn't something
similar to add to the Global.mpt file. Or is there?


Regards
Michael A.
 
R

Rod Gill

Did you try running it from a module in the Global.mpt file?

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com




MichaelA said:
Rod,

This works for the current project. It seems there isn't something
similar to add to the Global.mpt file. Or is there?


Regards
Michael A.




__________ Information from ESET Smart Security, version of virus
signature database 4462 (20090927) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4462 (20090927) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
M

MichaelA

Hello Rod,

No, I didn't; although I expect it will work fine when run from the
Global.MPT. However, I am looking to distribute a set of macros via a
template such that when a PM closes the template and open an
older .mpp file they will still have the functionality available to
them. That is, I need to find a way to modify the library references
of a PM's global.mpt without me having to intervene manually.

Your "copyToGlobal" is great, this is now the only missing piece.


Regards
Michael A.
 
R

Rod Gill

I haven't done it, but I think you will need to play around with setting
references in the Project_Open event of the global

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com




MichaelA said:
Hello Rod,

No, I didn't; although I expect it will work fine when run from the
Global.MPT. However, I am looking to distribute a set of macros via a
template such that when a PM closes the template and open an
older .mpp file they will still have the functionality available to
them. That is, I need to find a way to modify the library references
of a PM's global.mpt without me having to intervene manually.

Your "copyToGlobal" is great, this is now the only missing piece.


Regards
Michael A.




__________ Information from ESET Smart Security, version of virus
signature database 4465 (20090928) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4465 (20090928) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

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