Creating a batch file

Y

Yoav

Hello,
Is it possible to creat a batch file that opens MSP2003 Server Professional,
connects to a specific account, runs a specific macro and at the end closes
the Pro?
 
A

Adam Behrle

Hi Yoav,

You could do this using VBScript or JScript. You can then run your
script using the "cscript myscript.vbs" command.

Here is an example of what you want to do using VBScript:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Script Start
dim m_Shell
set m_Shell = CreateObject("WScript.Shell" )

'Start project in offline mode
m_Shell.Exec "C:\Program Files\Microsoft Office\OFFICE11\WINPROJ.EXE /
S """""

'Wait for project to start
WScript.Sleep 2000

'Capture the app from COM
dim projectApplication
set projectApplication = CreateObject("MSProject.Application")

'Run the macro
projectApplication.Macro "MyMacro"

'Quit without saving changes
projectApplication.Quit 0

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Script End

Hope that helps!

Adam
 
Y

Yoav

Thanks, Adam
I'm not familiar with this method, but it sure leads me to the golden path.
Thanks again!
Yoav
 
Y

Yoav

Hi, Adam
1. How can I open the Project Proffesional with a specific account (I'm
using MSP2003 Server).
2. The line 'projectApplication.Quit 0' gives an error message ("The method
is not available in this situation").
3. Where can I find more material about this method?
 
A

Adam Behrle

Hi Yoav,

1 - To start project and logon for a specific project server account,
use /s, /u, and /p switches. In the shell statement. Search for
"startup switches" in project help.
e.g winproj.exe /s "http://localhost/projectserver" /u
"administrator" /p "password"

2 and 3 - Chances are there is a dialog box open or something not
allowing the Quit command to execute. Take a look at the Quit method
in the VBA reference:

http://msdn2.microsoft.com/en-us/library/aa206174(office.11).aspx

Hope this helps.

Adam
 

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