ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Before print (https://www.excelbanter.com/excel-programming/342973-before-print.html)

Dm76

Before print
 
I would like a message to appear when someone tries to print a time sheet
that asks "Have you changed the date"

Paul B

Before print
 
Dm76, here is one way, put in thisworkbook code

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Msg = "Have you changed the date"
Title = "Continue ?"
Response = MsgBox(Msg, vbYesNo + vbQuestion, Title)

If Response = vbNo Then

'your code here if no

Cancel = True 'to cancel the print

Exit Sub ' Quit the macro
End If

'your code here if yes

End Sub




--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Dm76" wrote in message
...
I would like a message to appear when someone tries to print a time sheet
that asks "Have you changed the date"




Tom Ogilvy

Before print
 
Use the BeforePrint event

See Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy


"Dm76" wrote in message
...
I would like a message to appear when someone tries to print a time sheet
that asks "Have you changed the date"




Dm76

Before print
 
Thanks, worked a treat.

"Paul B" wrote:

Dm76, here is one way, put in thisworkbook code

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Msg = "Have you changed the date"
Title = "Continue ?"
Response = MsgBox(Msg, vbYesNo + vbQuestion, Title)

If Response = vbNo Then

'your code here if no

Cancel = True 'to cancel the print

Exit Sub ' Quit the macro
End If

'your code here if yes

End Sub




--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Dm76" wrote in message
...
I would like a message to appear when someone tries to print a time sheet
that asks "Have you changed the date"





Paul B

Before print
 
Your Welcome

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Dm76" wrote in message
...
Thanks, worked a treat.

"Paul B" wrote:

Dm76, here is one way, put in thisworkbook code

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Msg = "Have you changed the date"
Title = "Continue ?"
Response = MsgBox(Msg, vbYesNo + vbQuestion, Title)

If Response = vbNo Then

'your code here if no

Cancel = True 'to cancel the print

Exit Sub ' Quit the macro
End If

'your code here if yes

End Sub




--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Dm76" wrote in message
...
I would like a message to appear when someone tries to print a time

sheet
that asks "Have you changed the date"








All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com