1

I have been spending a great deal of time trying to solve this issue and searched many forums but I have not yet found a solution. Maybe someone here can find an answer...

I want to run some code (change some cells to shift conditional formatting, hide some rows etc.) before user prints the workbook.

In the old days this was simply accomplished by running the in-built _BeforePrint event in excel:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
    'Do something
End Sub

In excel 2010 and up the user are able to click print-preview after either hitting Ctrl-P or go to File->Print.

The _BeforePrint event only fires after the user actually clicks Print!

Therefore the user are seeing a print preview of the sheet before my macro has been running. The sheet now do not look good for printing and the user starts to manipulate the sheet because they do not know the sheet will be arranged for printing after they press the Print button.

Anyone got a solution to this?

stine
  • 61

0 Answers0