title: How to Print to PDF?
body: <p>I tried the following solution to print from Excel to PDF:</p>
  <p><a href="https://stackoverflow.com/questions/15030180/excel-2013-print-to-pdf-in-vba">Excel 2013 Print to PDF in VBA</a></p>
  <p>It produces</p>
  <blockquote>
  <p>run time error 1004</p>
  </blockquote>
  <p>on <code>wb.ExportAsFixedFormat</code>.</p>
  <p>My version of Excel: 2007.</p>
  <p>I changed the file path so it would save to my desktop.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub Invoice_to_PFD()
      'Saves the invoice print area to a PDF file
      
      Dim fp As String
      Dim wb As Workbook
      
      fp = &quot;C:\desktop\NewInvoice.pdf&quot;
      Set wb = ActiveWorkbook
      
      wb.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fp, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
      
  End Sub
  </code></pre>