Reputation: 1110
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
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