I have a form that people fill out, print, and scan to me. I want to set a macro so that when they hit print, it pops up a message box that reminds them I need their cover page and calculations pages. I have read dozens of help forum posts and copied many of the codes into sample excel sheets to try to get them to work and nothing happens. I have macros enabled. This is the code I currently have in my workbook. It is the one I have gotten closest with. It will pop up the message and if they hit "no" it will cancel the print, but if they hit "yes" it will pop up run-time error 438 (object doesn't support this property or method). Then when I try to debug it and open the VBA editor, even if I don't make any changes, the message won't even pop up the next time I print. I have to close out of excel and open it back up.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Confirm As VbMsgBoxResult
Application.EnableEvents = False
Cancel = True
Confirm = MsgBox("Reminder: Your underwriter needs both the cover page and any calculations pages. Continue?", vbYesNo)
If Confirm = vbYes Then ThisWorkbook.Print
Application.EnableEvents = True
End Sub
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Confirm As VbMsgBoxResult
Application.EnableEvents = False
Cancel = True
Confirm = MsgBox("Reminder: Your underwriter needs both the cover page and any calculations pages. Continue?", vbYesNo)
If Confirm = vbYes Then ThisWorkbook.Print
Application.EnableEvents = True
End Sub