[Last Call] Learn how to a build a cloud-first strategyRegister Now


Excel 2010 Before Print Event not working

Posted on 2012-09-20
Medium Priority
Last Modified: 2013-12-03
Hi Experts,

I have some VBA code that I would like to run before the user sends the print job to the printer.  I have tried the BeforePrint event in the workbook tab VB and cannot get the code run.  I have even tried to simply the code as follows and still not working,

Private Sub Workbook_BeforePrint(Cancel As Boolean)

    MsgBox ("hi")

End Sub

Any thoughts on what could prevent this from running?

Thanks in advance

Question by:JJINFM
  • 4
LVL 85

Expert Comment

by:Rory Archibald
ID: 38420963
It appears to be a bug. I've seen reports that it doesn't work 'by design' when using the backstage preview but it was supposed to work using the old full screen print preview, however I cannot get it to fire ever in my tests. I will file it as a bug.

Author Comment

ID: 38428869
OK, how to I resolve this open question.  Do I accept your comment as a solution?
LVL 85

Expert Comment

by:Rory Archibald
ID: 38429013
I'd suggest you leave it open for the time being and I will see if I get a response from MS that I can pass on, even if it's just confirmation of the issue.
LVL 85

Expert Comment

by:Rory Archibald
ID: 38429247
Hmm, just retested and after compiling my code I can now get the event to fire for a full screen preview or a print, but not from a Backstage preview (i.e. the File-Print screen) unless I actually print.
LVL 85

Accepted Solution

Rory Archibald earned 2000 total points
ID: 38444890
I think the lack of event from the backstage preview is by design, but actually printing or doing a full screen preview should fire it.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question