Launch project connected to server from Excel

J

Jason-W

Hi,

I'm trying to Launch MS Project from Excel so it uses the
profile for the Project Server (the PS account is set as
default). The related code is the following:

Dim MSP As Object
Set MSP = CreateObject("MSProject.Application")
MSP.Visible = True

When Project becomes visible, I can tell by looking at the
menus it has not connected to project server, since the
options for opening the resource pool & server projects
are diabled. And by using "?
application.Profiles.ActiveProfile.connectionstate" in
Project's VBA Immediate window, I get a value of 0
returned (indicating no connection to the server).

My question is: How do I get Project to connect to the
server through Excel? I'll need to be able to open a
couple enterprise projects and access the server macros.

Thanks.
--Jason
 
R

Rod Gill

Hi,

Try:

x = Shell("Winproj.exe /S http://servername/projectserver /U username
/P password", vbHide)
DoEvents 'this gives Project time to logon
'Create a project application:
Set objMSProject = CreateObject("MSProject.Application")
DoEvents

If you omit the /U (username) and /P (password) parameters, then its
assumed that a Windows Logon will be attempted. If you have a null
password, then you can send the command similar to:

x = Shell("Winproj.exe /S http://servername/projectserver /U username /P
""", vbHide)


--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
J

Jason-W

Rod,

Thanks. Works great.
--Jason
-----Original Message-----
Hi,

Try:

x = Shell("Winproj.exe /S
http://servername/projectserver /U username
/P password", vbHide)
DoEvents 'this gives Project time to logon
'Create a project application:
Set objMSProject = CreateObject ("MSProject.Application")
DoEvents

If you omit the /U (username) and /P (password) parameters, then its
assumed that a Windows Logon will be attempted. If you have a null
password, then you can send the command similar to:

x = Shell("Winproj.exe /S
http://servername/projectserver /U username /P
 

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