title: Save an Excel sheet as PDF programatically through powerbuilder
body: <p>There is a requirement to save an excel sheet as a pdf file programmatically through <code>powerbuilder</code> (Powerbuilder 12.5.1).</p>
  
  <p>I run the code below; however, I am not getting the right results. Please let me know if I should do something different.</p>
  
  <pre><code> OLEObject  ole_excel;
   ole_excel = create OLEObject;
  
   IF ( ole_excel.ConnectToObject(ls_DocPath) = 0 ) THEN
        ole_excel.application.activeworkbook.SaveAs(ls_DocPath,17);
        ole_excel.application.activeworkbook.ExportAsFixedFormat(0,ls_DocPath);
   END IF;
   ....... (Parsing values from excel)
   DESTROY ole_excel;
  </code></pre>
  
  <p>I have searched through this community and others for a solution but no luck so far. I tried using two different commands that I found during this search. Both of them return a null object reference error. It would be great if someone can point me in the right direction.</p>