Running macro from windows command prompt

S

Sachin

Hi,

I have the requirement of opening the file from command prompt and running a
macro. Is there a way to specify the macro name and passing in the arguments
from command prompt something like

c:\winproj.exe abc.mpp /m="My Macro("arg1")

Thanks in advance
Sachin
 
R

Rod Gill

HI,

Not according to help there isn't (though this is 2003 help as project 2007
help does not appear to have any information at all!).

All you can do is have an auto-open event in a project so the code runs
automatically on opening. You could have the macro test a registry setting
or contents of a txt file for information on which macro to run.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
S

Sachin

Thanks Rod!

I am able to achieve what I was looking for by making use of
FileObjectSystem in Project_Open. I am able to open a text file read it line
by line erform the required action and then close it once done

Private Sub Project_Open(ByVal pj As Project)
Dim oFSO As New FileSystemObject
Dim oFS
If oFSO.FileExists("c:\grasim.txt") Then
Set oFS = oFSO.OpenTextFile("c:\grasim.txt")
Do Until oFS.AtEndOfStream
stext = oFS.ReadLine
If stext <> Empty Then
FileOpen stext
'do something here
....
FileClose (pjSave)
Else
End If
Loop
Set oFS = Nothing
oFSO.DeleteFile "c:\grasim.txt"
MSProject.Application.Quit pjSave
End If
End Sub
 

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