title: Pywin32 save .docx as pdf
body: <p>I'm using Word 2013 to automatically create a report as a docx and then save it as a pdf format. </p>
  
  <p>But when I call the function SaveAs2(), the script pop out the "save as" windows and throws this exception : </p>
  
  <pre><code>(-2147352567, 'Exception occurred.', (0, u'Microsoft Word', u'Command failed', u'wdmain11.chm', 36966, -2146824090), None)
  </code></pre>
  
  <p>Here is my code to open and to save as a new file:</p>
  
  <pre><code>self.path = os.path.abspath(path)
  
  self.wordApp = win32.Dispatch('Word.Application')  #create a word application object
  self.wordApp.Visible = False  # if false hide the word application (app does't open but still usable)
  
  self.document = self.wordApp.Documents.Open(self.path + "/" + documentRef)  # opening the template file
  
  
  
  absFileName = "D:\\test.pdf"
          self.document.SaveAs2(FileName=absFileName,FileFormat=17)
  </code></pre>
  
  <p>And I'm using : 
  python2.7 with pywin32 (build 219)</p>
  
  <p>Does someone had an idea why it doesn't work?</p>