ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Message before print for specified worksheets (https://www.excelbanter.com/excel-worksheet-functions/132328-message-before-print-specified-worksheets.html)

inta251 via OfficeKB.com

Message before print for specified worksheets
 
On OfficeKB i found code

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Msg = "Warning message"
Title = "Warning TITLE"
Response = MsgBox(Msg, vbYesNo + vbQuestion, Title)
If Response = vbNo Then
Cancel = True
Exit Sub
End If
End Sub

This code for all workbook.
Need code for specified worksheets.
In my situation for now i have two worksheets 'trips' and 'statistic'
in the future may be more.
Where page setup paper size: Legal (8 1/2 x 14 in).
Messege will be: "Before print please insert to your printer paper size:
Legal (8 1/2 x 14 in)."

Thanks in advance.
Sincerely, Igor (inta251)

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200702/1


Bob Phillips

Message before print for specified worksheets
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
Select Case .Name
Case "trips", "statistic":
Msg = "Before print please insert to your printer paper
size:" & _
vbNewLine & "Legal (8 1/2 x 14 in)"
Title = "Warning TITLE"
Response = MsgBox(Msg, vbYesNo + vbQuestion, Title)
If Response = vbNo Then
Cancel = True
Exit Sub
End If
End Select
End With
End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"inta251 via OfficeKB.com" <u30987@uwe wrote in message
news:6e609b863e164@uwe...
On OfficeKB i found code

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Msg = "Warning message"
Title = "Warning TITLE"
Response = MsgBox(Msg, vbYesNo + vbQuestion, Title)
If Response = vbNo Then
Cancel = True
Exit Sub
End If
End Sub

This code for all workbook.
Need code for specified worksheets.
In my situation for now i have two worksheets 'trips' and 'statistic'
in the future may be more.
Where page setup paper size: Legal (8 1/2 x 14 in).
Messege will be: "Before print please insert to your printer paper size:
Legal (8 1/2 x 14 in)."

Thanks in advance.
Sincerely, Igor (inta251)

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200702/1




inta251 via OfficeKB.com

Message before print for specified worksheets
 
Thanks for respond.
Code working perfect.
THANKS again.
Sincerely, Igor (inta251)

--
Message posted via http://www.officekb.com



All times are GMT +1. The time now is 09:38 AM.

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