Excel export to PDF and FitToPagesTall

I have an Excel document that contains multiple sheets. I use the powershell to export the document to PDF, but unfortunately FitToPagesTall and FitToPagesWide do not work for me. I need the columns in the pdf document to be adapted to the page. Alternatively, please advise how to set the format (A4, A3). Can someone please advise me. Thank you
$path = "C:\doc\"
$xlFixedFormat = "Microsoft.Office.Interop.Excel.xlFixedFormatType" -as [type]
$excelFiles = Get-ChildItem -Path $path -include *.xls, *.xlsx -recurse
$objExcel = New-Object -ComObject excel.application
$objExcel.visible = $false
foreach($wb in $excelFiles)
$filepath = Join-Path -Path $path -ChildPath ($wb.BaseName + ".pdf")
$workbook = $objExcel.workbooks.open($wb.fullname, 3)
$workbook .PageSetup.Zoom = $false
$workbook .PageSetup.FitToPagesTall = 2
$workbook .PageSetup.FitToPagesWide = 2
$workbook.Saved = $true
"saving $filepath"

$workbook.ExportAsFixedFormat($xlFixedFormat::xlTypePDF, $filepath)


Would recommend a couple of things. First, enable the Developer tools in Excel in Options > Customize Ribbon. This will allow you to record macros. Do everything manually while recording a macro and that will give you VBA code to perform the actions. Next, search for something like ‘vba FitToPagesWide’ and you’ll see threads like this: