title: "No printers are installed" printing from Excel via COM
body: <p>I have LotusScript code running in IBM Domino 9.0 on a 64-bit Windows 2012 R2 server, which uses COM to launch Microsoft Excel 2010, open a workbook, then print via PDFCreator (from PDFForge) to convert the workbook to a PDF.<br>
  IBM Domino is running as a service under the SYSTEM user, so Excel and PDFCreator also run under that user when started by my code.</p>
  
  <p>This was working fine until two days ago, then PDFCreator started hanging on launch for no reason that I've determined.</p>
  
  <p>One of the admins for the customer reinstalled Excel and PDFCreator, and also deleted a Windows user profile (though I don't know for which user). Now PDFCreator is starting OK, but there have been several issues with Excel.</p>
  
  <p>I fixed some Excel issues with changes to my code and to the OS file system, but the problem now is when my code tells Excel to print the workbook, this error occurs:</p>
  
  <pre>Microsoft Excel: No printers are installed. To install a printer click the File tab, and then click Print.
  Click No Printers Installed, and then click Add Printer. Follow the instructions in the Add Printer dialog box.</pre>
  
  <p>This error only occurs when trying to print with my code.<br>
  I can launch Excel as an admin user and print manually, with three printers (including PDFCreator) available in the Print dialogue-box.</p>
  
  <p>It seems to me that the printers are just not visible to the SYSTEM user, but I have no idea how to verify or fix this.<br>
  What can I do about it?</p>
  
  <p>Several bits of code follow. I've removed some error handling and other things for brevity.</p>
  
  <p>The following code starts PDFCreator:</p>
  
  <pre><code>Set pdfCreator=CreateObject("PDFCreator.clsPDFCreator")
  If pdfCreator.cStart("/ClearCache /NoProcessingAtStartup") Then
      pdfCreator.cClearCache
      pdfCreator.cOption("PrinterTemppath")=pdfTmpDir
      pdfCreator.cOption("UseAutosave")=1
      pdfCreator.cOption("UseAutosaveDirectory")=1
      pdfCreator.cOption("AutosaveDirectory")=pdfTmpDir
      pdfCreator.cOption("AutosaveFormat")=0
      pdfCreator.cSaveOptions
      pdfCreator.cDefaultPrinter="PDFCreator"
  End If</code></pre>
  
  <p><code>pdfTmpDir</code> is a string variable containing a directory path, set elsewhere in the code.</p>
  
  <p>These lines start Excel:</p>
  
  <pre><code>Set xlApp=CreateObject("Excel.Application")
  xlApp.Visible=False</code></pre>
  
  <p>These lines open an existing workbook and print it.</p>
  
  <pre><code>Set xlBook=xlApp.Workbooks.Open(ceBCMSheet)
  xlBook.PrintOut ,,1,False,"PDFCreator"</code></pre>
  
  <p><code>ceBCMSheet</code> is a string variable containing the full path to an XLS file, set elsewhere in the code.</p>