MATLAB: Is it possible to adjust page setup options in Excel with MATLAB

excelpage setuppdfprint

If so, I would like to access Print, Page Setup, set to Landscape, and Fit to 1 pages wide and 100 pages tall. Then print to PDF with the same file name and delete the original *.xlsx file.

Best Answer

You can use the "actxserver" command in MATLAB to create Excel COM object and then use the functions exported by the COM object to Print, Page Setup. To find more information about the Excel COM functions, click on the following URL:
For more information about "actxserver" command and an example script to see how to use Excel COM object with MATLAB, click on the following URL:
You might find the following MATLAB script helpful to get started:
e = actxserver('Excel.Application');
e.Visible = 1;
e.Workbooks.Open('<your path to Excel file>');
%Print out Sheet 1 with default printer and settings
e.Worksheets.Sheets('Sheet1').PrintOut
delete('<your path to Excel file>');
Also, if you just want to save the file as PDF, you can use the Workbook's "SaveAs" function. To find more information about this function, click on the following URL: