I can't test this right now, but just looking at the code it would appear that wordapp.Documents.Add() is returning None instead of a word document object. Take out the close and quit lines and run it with python -i or type it in interactively and then you can do a dir() on the worddoc object and double-check that it is really what's being created.
<br><br>
<div class="gmail_quote">On Jan 10, 2008 3:23 AM, a_n_s_h_a_n <<a href="mailto:uvhs_t3p@yahoo.com">uvhs_t3p@yahoo.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>hi! newbie here. from the subject, there is an error in the code. could anyone please exlpain why? here's the code:</div>
<div> </div>
<div>import win32com.client</div>
<div>filename = 'D:\\FR23\\tickets\\07120306-IEEEToCGenerator\\test.doc'<br>wordapp = win32com.client.Dispatch("Word.Application") # Create new Word Object<br>wordapp.Visible = 0 # Word Application should`t be visible
<br>worddoc = wordapp.Documents.Add() # Create new Document Object<br># Make some Setup to the Document:<br>worddoc.PageSetup.Orientation = 0 # Portrait<br>worddoc.PageSetup.LeftMargin = 72<br>worddoc.PageSetup.TopMargin
= 72<br>worddoc.PageSetup.BottomMargin = 78.48<br>worddoc.PageSetup.RightMargin = 72<br><a href="http://worddoc.content.font.name/" target="_blank">worddoc.Content.Font.Name</a> = 'Verdana'<br>worddoc.Content.Font.Size
= 10<br>worddoc.Content.Paragraphs.TabStops.Add(100)<br>worddoc.Content.InsertAfter('PDF Filename: ')<br>worddoc.Content.MoveEnd<br>worddoc.SaveAs(filename)<br>worddoc.Close(SaveChanges = -1) # Close the Word Document
<br>wordapp.Quit() # Close the Word Application</div>
<div> </div>
<div>Thanks</div>
<div class="WgoR0d">
<p>
<hr size="1">
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. <a href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ+" target="_blank">Try it now.</a>
<p></p></p></div><br>_______________________________________________<br>python-win32 mailing list<br><a href="mailto:python-win32@python.org">python-win32@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank">
http://mail.python.org/mailman/listinfo/python-win32</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>_____________________<br>Ceci n'est pas un email.