Excel to pdf conversion regarding page issue

Hi All,

I have a scenario to convert excel to PDF , while I do that I need each sheet to fit in one page but instead one sheet splits in to 2 page in PDF? any idea how I can fit one page in PDF.

1 Like

Hi @SATHIYA_SEELAN,

  1. Use the “Excel Application Scope” activity to open the Excel file.
  2. Use the “Get Workbook Sheets” activity to get a list of all the sheets in the workbook.
  3. For each sheet, use the “Select Range” activity to activate the sheet.
  4. Use the “Invoke VBA” activity to run VBA code to set the print area for the sheet. Here’s an example of VBA code that you can use:
ActiveSheet.PageSetup.PrintArea = ActiveSheet.UsedRange.Address

This code sets the print area for the active sheet to the used range of the sheet, which should ensure that the sheet fits onto one page when printed.

  1. Use the “Export to PDF” activity to export the sheet to a PDF file.
  2. Repeat steps 3-5 for each sheet in the workbook.

By using the “Invoke VBA” activity to run VBA code to set the print area for each sheet, you should be able to ensure that each sheet fits onto one page in the resulting PDF file.