oro777
oro777

Reputation: 1110

Set Excel Zoom from MATLAB using ActiveX

By default the Excel zoom is 100% on all sheets. I am trying to change the zoom of Sheet1 to 80% using ActiveX from MATLAB.

Here is the code I tried, it did not give any error but the zoom remains unchanged.

Excel = actxserver('Excel.Application');
WB = Excel.Workbooks.Add;
Sheets = Excel.ActiveWorkbook.Sheets;
Sheet1 = Sheets.get('Item',1);
Sheet1.Activate;
Sheet1.PageSetup.Zoom = 80;
WB.SaveAs([pwd, '\test.xls'])
Excel.Quit();

Does the code miss something ?

Upvotes: 3

Views: 373

Answers (1)

EBH
EBH

Reputation: 10450

If you try to change the display zoom you are looking for this command:

Excel.ActiveWindow.Zoom = 80;

The PageSetup zoom applies when printing the worksheet.

Upvotes: 2

Related Questions