[python-win32] AttributeError: 'NoneType' object has no attribute 'PageSetup'
a_n_s_h_a_n
uvhs_t3p at yahoo.com
Thu Jan 10 12:23:16 CET 2008
hi! newbie here. from the subject, there is an error in the code. could anyone please exlpain why? here's the code:
import win32com.client
filename = 'D:\\FR23\\tickets\\07120306-IEEEToCGenerator\\test.doc'
wordapp = win32com.client.Dispatch("Word.Application") # Create new Word Object
wordapp.Visible = 0 # Word Application should`t be visible
worddoc = wordapp.Documents.Add() # Create new Document Object
# Make some Setup to the Document:
worddoc.PageSetup.Orientation = 0 # Portrait
worddoc.PageSetup.LeftMargin = 72
worddoc.PageSetup.TopMargin = 72
worddoc.PageSetup.BottomMargin = 78.48
worddoc.PageSetup.RightMargin = 72
worddoc.Content.Font.Name = 'Verdana'
worddoc.Content.Font.Size = 10
worddoc.Content.Paragraphs.TabStops.Add(100)
worddoc.Content.InsertAfter('PDF Filename: ')
worddoc.Content.MoveEnd
worddoc.SaveAs(filename)
worddoc.Close(SaveChanges = -1) # Close the Word Document
wordapp.Quit() # Close the Word Application
Thanks
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080110/3d28a7ed/attachment.htm
More information about the python-win32
mailing list