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
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 "Sachin" wrote in message news:941EB9D6-27B9-4344-B562-181C5A7ABDA9@microsoft.com... > 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
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 "Rod Gill" wrote: > 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 > > > > "Sachin" wrote in message > news:941EB9D6-27B9-4344-B562-181C5A7ABDA9@microsoft.com... > > 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 > >