Excel sheet to pdf

Hi, I want to convert complete one excel sheet to pdf. If I use save excel as pdf activity it will be giving certain columns based on the size and remaining columns will be coming below in next page.
Can anyone help on these query?

@oraganti931

please try these

Try first approach

Alternately…go with vba

Sub ExportToPDFAndFitToPage()
    Dim ws As Worksheet
    Dim filePath As String

   
    Set ws = ThisWorkbook.ActiveSheet
    
  
    filePath = "C:\path\to\your\file.pdf" ' Replace with your desired file path

  
    ws.ExportAsFixedFormat Type:=xlTypePDF, Filename:=filePath, _
                          Quality:=xlQualityStandard, IncludeDocProperties:=True, _
                          IgnorePrintAreas:=False, OpenAfterPublish:=True, _
                          From:=1, To:=1, OpenAfterPublish:=True
End Sub

cheers

Hi
You can try with this

Cheers @oraganti931

Currently I am using sma e activity but It is compatible for windows legacy not for windows. Currently we are migrating process from windows legacy to windows.

Ok, will try this approach.

1 Like

Hello @oraganti931

  1. Use “Excel Application Scope” to open the Excel file.
  2. Inside, add “Invoke VBA” to set page setup for one page.
  • VBA code: ActiveSheet.PageSetup.Orientation = xlPortrait and ActiveSheet.PageSetup.FitToPagesWide = 1
  1. Add “Export to PDF” to save the sheet as PDF.
  2. Close Excel using “Close Workbook” activity.

Thanks & Cheers!!!

Hi this is not working

Do you want me to use export to pdf activity. Idf that is the case I have save excel as pdf.

1 Like

@oraganti931

Yes, you can continue using the “Save Excel as PDF” activity if it’s already working for your Excel-to-PDF conversion. There’s no need to use the “Export to PDF” activity in this case.