Excel 365 Print Preview

╄→尐↘猪︶ㄣ 提交于 2020-01-06 20:18:09

问题


I'm using Excel 365 on Windows 7 Home 64bit. When I open Print Preview from the Excel user interface I get a window with options like this:

https://www.flickr.com/photos/132482128@N08/21711947524/in/dateposted-public/

From this window I can preview the whole print file, make adjustments to margins, select the printer to use, etc. I would like to access this window and these options from VBA. However when I use:

ActiveWorkbook.Sheets("SheetName").PrintOut Preview:=True

or:

ActiveWorkbook.Sheets("SheetName").PrintPreview EnableChanges:=True

I get a window with options like this:

https://www.flickr.com/photos/132482128@N08/21713621773/in/dateposted-public/

I can only view the first page of the print file, and I am unable to change the printer. I have tried this:

Application.Dialogs(xlDialogPrint).Show

but it still does not bring up the modern Excel 365 PrintPreview dialogue and doesn't allow me to define what I want printed.

What am I doing wrong?
How do I get the new 365 type PrintPreview?

BTW - Using the .PrintPreview method in Word 365 VBA brings up the 365 PrintPreview dialogue, as you would expect.


回答1:


Try this:

Application.CommandBars.ExecuteMso "PrintPreviewAndPrint"

Reference: row 649 in this workbook:

http://excelhero.com/resource/excel2013ribboncontrolidentifiers.xlsx



来源:https://stackoverflow.com/questions/33242291/excel-365-print-preview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!