VBA invoke MSP Server

S

Steve Scott

I have an estimating template built in Excel that when filled in, I click a
button and it runs some code that opens up and creates a plan in MSP2000
based on the data I have entered into Excel.

If our organsisation deploys Project Server, can this still work ie if we
change the code so that it invokes MSP2003 professional and connects to
project server - will it still be able to create the plan onto teh Enterprise
template as opposed to a non-enterprise template? Or must we continue to do
this outside Project Server and then import the resultant plan/s into Server?

Rgds

Steve
 
R

Rod Gill

Hi,

Here is some code that runs from Excel (or any other VBA or VB application),
opens Project Professional, connects to Project Server, reports the
connection state then Quits Project. You need a reference to Project object
library and for this code use NT Authentication to login to Project Server
on the PC running the code.

You should be able to copy/paste what you need.

Sub StartProject()
'Requires Reference to Microsoft Project
Dim projApp As MSProject.Application
On Error Resume Next
Shell "winproj.exe /s http://ServerName/ProjectServer/"
Do Until Not (projApp Is Nothing)
DoEvents
Set projApp = GetObject(, "MSProject.Application")
Loop
Debug.Print projApp.Name
Debug.Print projApp.Profiles. _
ActiveProfile.ConnectionState
projApp.Quit
Set projApp = Nothing
End Sub

Out of interest, the code is from my new book "Project VBA (Programming VBA
for Microsoft Office Project", available at MSProjectExperts and Amazon) and
it ships next week. (Sorry, had to say this, I've just found out next week
is when it arrives!)
 

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