Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default How to create pop-up message in Excel before Printing

Hi All,

I have a huge file that consumes reams of paper when printed. So I want
a message box to appear when people click on the print icon in Excel
(or click on File Print or Ctrl-P), suggesting that they should only
print relevant sections of the document.

Can someone suggest some basic macro code to achieve this?

Thanks!
123champ

  #2   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default How to create pop-up message in Excel before Printing

YOu can use the Workbook_BeforePrint event, which is activate before print
preview or before the document is sent to the printer.
--
Kevin Backmann


" wrote:

Hi All,

I have a huge file that consumes reams of paper when printed. So I want
a message box to appear when people click on the print icon in Excel
(or click on File Print or Ctrl-P), suggesting that they should only
print relevant sections of the document.

Can someone suggest some basic macro code to achieve this?

Thanks!
123champ


  #3   Report Post  
Posted to microsoft.public.excel.misc
Otto Moehrbach
 
Posts: n/a
Default How to create pop-up message in Excel before Printing

You would use a Workbook_BeforePrint macro for that. You can write code in
that macro telling the user whatever you want. You can also cancel the
print command in the same macro. Here is one suggested code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Ans As Long
Ans = MsgBox("It is recommended that you print only a portion" & Chr(13)
& _
"of this workbook and not the entire workbook." & Chr(13) & _
"Do you want this print job to continue?", 4, "Continue Print?")
If Ans = vbNo Then Cancel = True
End Sub
HTH Otto
wrote in message
ups.com...
Hi All,

I have a huge file that consumes reams of paper when printed. So I want
a message box to appear when people click on the print icon in Excel
(or click on File Print or Ctrl-P), suggesting that they should only
print relevant sections of the document.

Can someone suggest some basic macro code to achieve this?

Thanks!
123champ



  #4   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default How to create pop-up message in Excel before Printing

This is a bit more illustrative than my previous post:

Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim YesNo As Integer

YesNo = MsgBox("Only print relevant data. Do you wish " & _
"to continue?", vbYesNo, "Yo! What's Up")

If YesNo = vbNo Then
Cancel = True
End If

End Sub

Press Alt+F11 to open the VB editor and if necessary press Ctrl+R to open
the Project window. In the project window locate the VBA project for the
current file and double click on the ThisWorkbook object (you might have to
double click your way through the tree to display everything).

In the code window on the right, drop down the list at the top of the screen
that currently says General and select workbook, and then to the right of
that, drop down the list and select the BeforePrint event. The code goes
right here.
--
Kevin Backmann


" wrote:

Hi All,

I have a huge file that consumes reams of paper when printed. So I want
a message box to appear when people click on the print icon in Excel
(or click on File Print or Ctrl-P), suggesting that they should only
print relevant sections of the document.

Can someone suggest some basic macro code to achieve this?

Thanks!
123champ


  #5   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default How to create pop-up message in Excel before Printing

Hi Kevin,

That worked beautifully!!
Thanks for the code, and for saving trees!

cheers
123champ

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop excel from dropping the 0 in the beginning of a number? Rosewood Setting up and Configuration of Excel 12 April 4th 23 02:12 PM
Error message when using Excel to open text file orutulsa Excel Discussion (Misc queries) 2 March 14th 06 06:10 PM
Removing Rows for Printing Frick Excel Worksheet Functions 20 March 10th 06 10:53 PM
How do I create a List in Excel 2000 Watch Online Excel Worksheet Functions 1 January 31st 06 07:45 PM
Excel error message John Excel Discussion (Misc queries) 3 June 21st 05 05:52 AM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"