0 Replies - 393 Views - Last Post: 11 September 2012 - 12:40 PM Rate Topic: -----

#1 Malluce  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 05-December 09

Editing .mpp File using Python

Posted 11 September 2012 - 12:40 PM

Currently I'm trying to write a script in Python to edit MS Project files. I'm trying to use the pywin extension (COM) but there
are not many documentations out there so I have no idea how it works. I am playing with one of the examples I found but I don't know how to edit the specific content in the file. Here's the code snippet:
import win32com.client
doc = 'C:\Release_Plan.mpp'
try:
	mpp = win32com.client.Dispatch("MSProject.Application")
	mpp.Visible = 1
	try:
		mpp.FileOpen(doc)
		proj = mpp.ActiveProject
		print proj.BuiltinDocumentProperties(1)
		print proj.BuiltinDocumentProperties(2)
		print proj.BuiltinDocumentProperties(3)
		print proj.BuiltinDocumentProperties(4)
		print proj.BuiltinDocumentProperties(5)
	except Exception, e:
		print "Error", e
	mpp.FileSave()
	mpp.Quit()
except Exception, e:
	print "Error opening file",e


I want to know what other object I can get under the class win32com.client.Dispatch.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1