Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Project Automation
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00358711
Message ID:
00359750
Views:
8
>Anyone done any automation of MS Project? If so, could you please steer me in the right direction for getting started. i.e. the correct parameters for CREATEOBJECT(), any help files or docs, how to add items, etc. TIA

Colin:
Here is a little code that we use:

***********************************************************************8
WAIT WINDOW "Now Creating CPM Template for " + ALLT(vSelectedproject.cProjectname) + " - Please Stand By" NOWAIT NOCLEAR

SELECT 0
USE pas!vroofactv

lcDirectory = ALLT(vselectedproject.cDirectory)

lcFileName = ALLT(SUBSTR(lcDirectory,RAT("\",lcDirectory) + 1,7)) + "r.mpp"

lcOutputfile = lcDirectory + "\" + STR(gnProgramyear,4) + "\schedule\" + lcFilename
goMsproject = CREATEOBJECT("MSPROJECT.APPLICATION")
goMsproject.Application.Visible = .T.
goMsproject.FileOpen(gcRoofingMPPFile)

goMSProject.ActiveProject.CustomDocumentProperties.Add("File Source",.F.,4,"Roofing Contractor")
goMSProject.ActiveProject.CustomDocumentProperties.Add("Project Name",.F.,4,vSelectedProject.cProjectname)
goMSProject.ActiveProject.CustomDocumentProperties.Add("Project Number",.F.,1,vSelectedProject.nProject)

goMsproject.SetTaskField("Name",ALLT(vselectedproject.cProjectname) + " - " + ALLT(vselectedproject.cDivision))

llFirst = .T.
SELECT vroofactv
SCAN
goMsproject.SelectTaskField(1,"Name")
goMsproject.SetTaskField("Name",ALLT(vroofactv.cItemletter) + " " + vroofactv.cDescription)
goMsproject.SetTaskField("Cost",vroofactv.nAwardamount)
IF llFirst
goMsproject.OutlineIndent
llFirst = .F.
ENDIF
ENDSCAN
goMsproject.ActiveProject.ProjectStart = DTOC(vSelectedProject.dRoofingNTP)

goMsproject.FileSaveAs(lcOutputFile)

goMsproject.Application.Quit

WAIT CLEAR
lcMessage = lcOutputFile + " has been created"
=MESSAGEBOX(lcMessage,64,"CPM Template created")

RETURN


HTH,
Mike Collins
Mike C.
-------
I keep trying to find a life of my own, apart from you.
DC Talk/Charlie Peacock, In the Light.
www.risensystems.com/ra/itlbegin.rm
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform