|
|
|
| Create Project Server Account with VBA |
Applicable to: MS Project Server 2003 and MS Project Server 2007
Purpose:
Copy and paste the following macro in any MPP file. By running this macro, it creates the project server account with windows user name and set it as a default account with “Automatically detect connection state”.
This macro automate the steps involved in the process of creating the project server account from Tools -> Enterprise options -> Microsoft project server accounts.
How to Distribute VBA to Project Professional Users:
- Open blank MPP
- Tools menu -> Macro -> Visual Basic Editor
- Click on ThisProject at left pane
- Choose Project from first dropdown at right side code window; Choose Open from second dropdown
- Paste the macro code listed below; Please change the following in macro code as per your needs. In the following macro, account name is EPM2007 and Project server URL is http://projectserver/pwa/
ObjProject.Profiles.Add "EPM2007", "http://projectserver/pwa/"
- File -> Save -> Provide file name like "MSPS Profile VBA.mpp"
- Send this MPP to new Project Professional user, when they open this project plan, it
automatically creates the Project Server profile
Note: Macro security be atleast medium to run this macro. Ask your users to set the macro security level before run this macro. (Launch MS Project Professional -> Tools -> Macro -> Security -> Medium-> OK ->Exit Project Professional)
******************************************************
Private Sub Project_Open(ByVal pj As Project)
Dim ObjProject As Object
Dim iProfileCount As Long
Dim iNewProfilePostion As Long
Set ObjProject = CreateObject("msproject.application")
iProfileCount = ObjProject.Profiles.Count
iNewProfilePostion = iProfileCount + 1
ObjProject.Profiles.Add "EPM2007", "http://projectserver/pwa/"
ObjProject.Profiles.DefaultProfile = ObjProject.Profiles.Item(iNewProfilePostion)
MsgBox ("Project Server Account named EPM 2007 has been created")
ObjProject.Quit
Set ObjProject = Nothing
End Sub
*********************************************************
| |
|