PDA

View Full Version : Message Box Pop-Up "yes or no"



Ryan_Bernal
02-19-2013, 12:49 PM
I need help.
I have vba code that print labels and i need to modify the code.
Before printing the user will ask to print the the document.
If the user will choose "YES" then continue printing. If the user opt to "NO" it will cancel printing.
Here is my codes but i don't know how to combine.. Any help will be appreciated.Thanks in advance.


Sub PrintLabels()
'Please Do not alter any codes Here!
Dim Labels As Long, Lbl As Long


Labels = Sheets("INPUT").[C13]

With Sheets("FORM")
For Lbl = 1 To Labels Step 2
.Range("B9") = Lbl
If Lbl < Labels Then
.Range("B23") = Lbl + 1
Else
.Range("B23") = ""
End If

.PrintOut Copies:=1
Next Lbl
End With

End Sub


and this code


Sub Print_option()

MSG1 = MsgBox("Are you sure you want to print this document? ", vbYesNo, "SAVE PAPER!Check Before you Print!")

If MSG1 = vbYes Then
MsgBox "Print"
Else
MsgBox "Cancel"
End If

End Sub

Ryan_Bernal
02-19-2013, 06:20 PM
I already found solution for this.
Thanks.


Sub Print_option()
If MsgBox("Are you sure you want to print this document? ", vbYesNo, "SAVE PAPER!Check Before you Print!") = vbYes Then
PrintLabels
Else
MsgBox "Printing Cancelled!"
End If
End Sub