I happened to install the pdf add-in on my machine and used the below code to generate the pdf.
- Create a new object action inside the Ms Excel VBO and have the Start and Code stages as below. I made a duplicate copy of the Open Workbook stage and used it.
View attachment 2389
- Start stage Input parameters:
View attachment 2387
- Code stage Input parameters:
View attachment 2386
- Code stage:
View attachment 2388
Code:
Dim wb as Object = GetInstance(handle).Workbooks.Open(filename)
wb.Activate() 'can skip this line
wb.ExportAsFixedFormat (Type:=0, Filename:=FullPdfFilePath, Quality:=0) '0:=xlTypePDF, 0:=xlQualityStandard
'Refer other list of parameters in below link
'https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.exportasfixedformat
wb = Nothing
- Input Excel File (Sheet1) and Process Diagram:
I have used the 'Open Workbook' action in the diagram to 'Show' the workbook, you may skip that if you don't need to display.
View attachment 2385
- Call to the new action from the Process diagram:
View attachment 2390
- Sample Output.pdf (opened in Chrome):
Page 1 from Sheet 1:
View attachment 2391
Page 2 from Sheet 2:
View attachment 2392