Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pop Up Message before printing

I have the following code that prints out different sheets.
What code should I use that will make a message pop up
asking "Are you Sure you want to Print Yes/No" to prevent someone pressing
the print button in error?

Thanks in advance of any favourable reply.

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").Range("newused") = 1
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
If Sheets("Customer Profile").Range("pxselect") 0 Then
Sheets("Handback").PrintOut Copies:=1, Collate:=True
Sheets("New").Range("cuscopynew") = "CUSTOMER COPY"
Sheets("New").PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
End If
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Pop Up Message before printing

John Web wrote:
I have the following code that prints out different sheets.
What code should I use that will make a message pop up
asking "Are you Sure you want to Print Yes/No" to prevent someone pressing
the print button in error?


If (MsgBox ("Are you sure you want to print?", vbYesNo) = vbYes) Then
' print
End If



Best Regards,

Lars
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Pop Up Message before printing

Hi,

Mahe these the first 2 lines of your code

response = MsgBox("Do you really want to print?", vbOKCancel)
If response = vbCancel Then Exit Sub

Mike

"John Web" wrote:

I have the following code that prints out different sheets.
What code should I use that will make a message pop up
asking "Are you Sure you want to Print Yes/No" to prevent someone pressing
the print button in error?

Thanks in advance of any favourable reply.

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").Range("newused") = 1
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
If Sheets("Customer Profile").Range("pxselect") 0 Then
Sheets("Handback").PrintOut Copies:=1, Collate:=True
Sheets("New").Range("cuscopynew") = "CUSTOMER COPY"
Sheets("New").PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
End If
Application.ScreenUpdating = True
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Pop Up Message before printing


Private Sub CommandButton2_Click()
Dim Msg, Style, Title, Response
Msg = "Do you want to print?"
Style = vbYesNo + vbQuestion
Title = "Print"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Application.ScreenUpdating = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").Range("newused") = 1
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
If Sheets("Customer Profile").Range("pxselect") 0 Then
Sheets("Handback").PrintOut Copies:=1, Collate:=True
Sheets("New").Range("cuscopynew") = "CUSTOMER COPY"
Sheets("New").PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
End If
Application.ScreenUpdating = True
Else
End If
End Sub

"John Web" wrote:

I have the following code that prints out different sheets.
What code should I use that will make a message pop up
asking "Are you Sure you want to Print Yes/No" to prevent someone pressing
the print button in error?

Thanks in advance of any favourable reply.

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").Range("newused") = 1
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
If Sheets("Customer Profile").Range("pxselect") 0 Then
Sheets("Handback").PrintOut Copies:=1, Collate:=True
Sheets("New").Range("cuscopynew") = "CUSTOMER COPY"
Sheets("New").PrintOut Copies:=1, Collate:=True
Sheets("Dan").PrintOut Copies:=1, Collate:=True
Sheets("Customer Profile").PrintOut Copies:=1, Collate:=True
End If
Application.ScreenUpdating = True
End Sub

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
Reminder message before printing Jim G Excel Discussion (Misc queries) 7 April 26th 07 02:52 AM
error message during printing Urgent ! Excel Discussion (Misc queries) 1 February 1st 06 05:03 PM
error message during printing Urgent ! Excel Discussion (Misc queries) 0 February 1st 06 04:17 PM
Printing with a message Rmagic[_10_] Excel Programming 3 November 20th 05 11:03 PM
Deactivating Printing Message TONYC[_10_] Excel Programming 7 August 14th 04 12:54 AM


All times are GMT +1. The time now is 08:34 PM.

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

About Us

"It's about Microsoft Excel"