title: MS Word 2013 variant does not reference an automation object
body: <p>I have just upgraded from office to office 2013. One of my apps uses MSWord automation to convert word to pdf.</p>
  
  <p>The following code worked ok for Word 2007 and 2010, but not I keep getting the above OLEError at the call to MSApp.Documents.open. The code is below. Does anyone have any idea what is going wrong? I have also tried stripping out all params to the call to open other than the filename, but this still falls down with the above exception</p>
  
  <pre><code>Function convertToPDF(filename:string);
  var MSApp, doc:variant;
  begin
  MSApp := CreateOLEObject('Word.Application');
      try
        MSApp.visible:=false;
  
        MSApp:=MSApp.version;
        version:=trunc(strToFloat(MSApp));
  
        if version&gt;11 
      then begin //should be greater than word 2003 so should have capability of printing to pdf
                Doc:=MSApp.Documents.Open(fileName, false, true, false);
                MSApp.ActiveDocument.SaveAs(outputfile, wdFormatPDF, emptyParam, emptyparam, false);
              end;
  finally
      varclar(doc);
      msApp.quit;
  end;
  end;
  </code></pre>