Excel 365 Print Preview

2019-09-14 15:47发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-14 15:59

Try this:

Application.CommandBars.ExecuteMso "PrintPreviewAndPrint"

Reference: row 649 in this workbook:

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

查看更多
登录 后发表回答