从Access 2007应用程序启动Project Professional 2010客户端 [英] Launching Project Professional 2010 client from Access 2007 application
问题描述
您好,
Hello,
我需要从Access应用程序启动Project Professional 2010客户端。在VB代码中,我有ProjectUID可用于需要在Project Professional 2010 Client中打开的项目。从应用程序的不同部分,我可以通过使用URL(以及ProjectUID)从我的PS 2010服务器打开特定的项目文件。显然,启动Project Professional 2010客户端时无法做到这一点。
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.
如果有人之前已经这样做了,请你分享一下VB代码片段吗?重申一下,我的应用程序是用Access 2007编写的。
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.
提前致谢。
HeliosRex
HeliosRex
推荐答案
在这里,直接从我的Project VBA书出来:
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
您必须使用Shell命令启动Project,以便在启动时将服务器名称传递给它。此代码使用Windows身份验证,但/ u和/ p参数(我很薄)允许传递用户名和密码。
此代码应适用于任何Office应用程序的任何版本。
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.
这篇关于从Access 2007应用程序启动Project Professional 2010客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!