Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
other
informationbridge
office.intranets
office.misc
office.setup
office.xml
officeupdate
onenote
photodraw.discussion
powerpoint
producer
proj.standard&server
project
project.developer
project.pro_and_serve
project.server
project.vba
project2000
publisher
publisher.prepress
publisher.programming
publisher.webdesign
visio
visio.createshapes
visio.database.modeling
visio.dev.diagrams
visio.dev.shapesheet
visio.dev.vba
visio.dev.vc
visio.developer
visio.general
visio.installation
visio.printing
visio.software.modeling
visio.troubleshoot
  
 
date: Tue, 8 Jul 2008 21:50:01 -0700,    group: microsoft.public.project.developer        back       


Running macro from windows command prompt   
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
date: Tue, 8 Jul 2008 21:50:01 -0700   author:   Sachin

Re: Running macro from windows command prompt   
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
date: Wed, 9 Jul 2008 17:09:02 +1200   author:   Rod Gill rodATproject-systemsDOTcoDOTnz

Re: Running macro from windows command prompt   
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 
> 
>
date: Sat, 12 Jul 2008 05:51:01 -0700   author:   Sachin

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us