View Single Post
 
Old 06-08-2016, 09:01 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

This is relatively straightforward. Add a class module to the document call it EventClassModule
In that module put the following example code. Edit it to reflect your check boxes and the message you wish to convey
Code:
Option Explicit
Public WithEvents appWord As Word.Application

Private Sub appWord_DocumentBeforePrint _
        (ByVal Doc As Document, _
         Cancel As Boolean)
Dim intResponse As Integer
Dim sBox As String

    Select Case False
        Case ThisDocument.CheckBox1.Value: sBox = "CheckBox 1"
        Case ThisDocument.CheckBox2.Value: sBox = "CheckBox 2"
        Case ThisDocument.CheckBox3.Value: sBox = "CheckBox 3"
    End Select


    intResponse = MsgBox(sBox & " has not been checked!", _
                         vbOKCancel)
    If intResponse = vbCancel Then Cancel = True
End Sub
Add an ordinary module to the document and add the following code
Code:
Option Explicit
Dim X As New EventClassModule
Sub AutoOpen()
    Register_Event_Handler
End Sub
Sub Register_Event_Handler()
    Set X.appWord = Word.Application
End Sub
Save the document as a macro enabled document. When the document is opened the autoopen macro runs and sets the event handler. (You can run it from the module for testing).
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote