RP1America
Technical User
I have a userform, where upon a click event, 246 Word documents are opened, bookmarks populated, saved, and closed in succession.
I would like to create a message box to come up at the beginning of this process that asks the user if they want to abort, since the entire process takes 5 - 7 minutes. I would like to give them the option of aborting if they realize half way through that they entered something incorrectly and need to start from scratch.
Currently I have this...
I thought it might completely bypass the code that creates the docs if the OK (abort) were clicked.
However, currently when the message box comes up, the rest of the code halts and waits for the "OK" button to be pressed. Even then, it continues on creating the documents. What am I missing? I would like the rest of the code to run, UNTIL the button is pressed. Once pressed, everything stops.
Any ideas?
Thanks!
I would like to create a message box to come up at the beginning of this process that asks the user if they want to abort, since the entire process takes 5 - 7 minutes. I would like to give them the option of aborting if they realize half way through that they entered something incorrectly and need to start from scratch.
Currently I have this...
Code:
Private Sub cmdCreate_click()
'abort message box
If MsgBox("Abort File Creation?", vbMsgBoxSetForeground, "Abort?") = True Then GoTo FINISH:
'''''''additional code here that creates the docs
FINISH:
'close document if more Word documents are open, otherwise close Word application
If Documents.Count > 1 Then
' more than one doc open
ActiveDocument.Close
Else ' count = 1
ActiveDocument.Close
Application.Quit
End If
End Sub
I thought it might completely bypass the code that creates the docs if the OK (abort) were clicked.
However, currently when the message box comes up, the rest of the code halts and waits for the "OK" button to be pressed. Even then, it continues on creating the documents. What am I missing? I would like the rest of the code to run, UNTIL the button is pressed. Once pressed, everything stops.
Any ideas?
Thanks!