Project References

J

Jason Curns

Does anyone know of a way to determine the references (tools-references)
being used by a Microsoft Project file programmatically?

Thanks
 
J

John

Hi Jason,
How's your dad doing? I worked with him when he did some consulting for
our company a few years back. As I recall you developed the ScheduleLynx
application based on some work he was doing on one of our company's
programs.

I don't have a full answer to your question but this might help if you
haven't tried it already. When faced with a similar situation some years
ago, I created an auto_open macro (Project 4.x) that ensured a reference
was set to the Excel object library each time a CAM's file was opened. I
guess it would be possible to set up a similar macro that cycled through
each object library of interest and set it if necessary.

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

Hope this helps.
John Jensen
 
J

John

Jason,
After I posted my first reply, I queried the MVP experts in the
visualbasic newsgroup. Here is the response I received. I looked at each
of the links but on first read, most of it is over my head. Maybe it
will make more sense to you. If it doesn't help or you have more
questions, I'll ask Tony if he has any problem with me giving you his
e-mail.

DLL Heaven A Possible Solution Sample code showing you some means of
fixing things yourself.
http://www.papwalker.com/dllhell/index.html

Subject: INFO: How to guarantee that references will work in your
applications. http://www.trigeminal.com/usenet/usenet026.asp?1033

From the links section at OCX/DLL Version Checker
http://www.granite.ab.ca/access/ocxdllversionchecker.htm
This MDB verifies the remote systems OCX/DLL versions against your
version.

Tony
--
Tony Toews, Microsoft Access MVP
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm

John
Project MVP
 
J

John

Jason,
I got another response on my query to the other experts. Try this code,
it worked great when I tried it.

Sub TestForReferences()
Dim oRef As Object
For Each oRef In ThisProject.VBProject.References
Debug.Print oRef.Name, oRef.Description
Next
End Sub

John
 
J

Jason Curns

You the Man!!!
What we have been faced with is MS Project files that contained references
to MS Project versions that were not installed on the client machine. The
references were created when 2002 version users open the project and record
macros within the file. Once saved, the reference to Project 2002 is made.
Form then on, when someone using 2000 opens the project file and attempts to
run or record a macro in that file, they receive and error that the
application has an invalid reference and you cant just simply change it.

Anyway, this code allows me to target the questionable project file and
check for invalid references.

Thanks Again John!
Take Care
 
J

John

Just for reference to other newsgroup readers, I'm not the one who
deserves the credit. All I did was to act as the middle-man. Stephen
Bullen (an MVP in a visual basic newsgroup) provided the answer.

John
 

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