Launching Project Professional 2010 client from Access 2007 application
-
3 พฤษภาคม 2555 19:45
Hello,I need to launch Project Professional 2010 Client from my Access application. In the VB code, I have the ProjectUID available for the project that needs to be opened in Project Professional 2010 Client. From a different part of the application I am able to open a particular project file from my PS 2010 server by using the URL (along with the ProjectUID). Apparently, the same is not possible when launching Project Professional 2010 client.
If anyone has done this before, could you please share the snippet of VB code that does it? Just to reiterate, my application is written in Access 2007.
Thanks in advance.
HeliosRex
ตอบทั้งหมด
-
3 พฤษภาคม 2555 21:11ผู้ดูแล
Here you go, straight out of my Project VBA book:
Sub StartProject() 'Requires Reference to Microsoft Project Dim projApp As MSProject.Application On Error Resume Next 'Start Project Shell "winproj.exe /s http://ServerName/ProjectServerName/" Do Until Not (projApp Is Nothing) 'Wait for Project to connect DoEvents Set projApp = GetObject(, "MSProject.Application") Loop Debug.Print projApp.Name 'Debug.Print sends message to Immediate Window Debug.Print projApp.Profiles.ActiveProfile.ConnectionState projApp.Quit Set projApp = Nothing End Sub
You have to use the Shell command to start Project so you can pass the Server name to it on start up. This code uses Windows authentication, but /u and /p parameters (I thin) allow passing a user name and password.
This code should work in any version of any Office application.
Rod Gill
The one and only Project VBA Book
Rod Gill Project Management
- เสนอเป็นคำตอบโดย Rod Gill MVPMVP, Moderator 3 พฤษภาคม 2555 21:13
-
3 พฤษภาคม 2555 21:48
Rod,
Thanks for the quick reply. Along with the server information, how can I pass a particular ProjectUID so that it connects to the server and opens a project (with ProjectUID passed) in the client?
HeliosRex
-
4 พฤษภาคม 2555 1:16ผู้ดูแล
Now you use the ProjApp to control everything and everything in Project.
Simplest way to learn is to record a macro of you opening a project from Project Server. All you need is the Project Title. If you only have a GUID then you need to used OLEDB to read the title from the Reporting db.
Note: when recording a macro, Choose This Project for macro Store location as you don't want to fill the Global.Mpt with recorded macros.
Rod Gill
The one and only Project VBA Book
Rod Gill Project Management