View Single Post
 
Old 05-25-2017, 06:56 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,143
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

I don't know what I was thinking this morning when I answered the question originally The code for Userform1 should be

Code:
Option Explicit

Private Sub CommandButton1_Click()
    Hide
    Tag = 1
End Sub

Private Sub CommandButton2_Click()
    Hide
    Tag = 0
End Sub
i.e. Tag = 0 is the response from the Cancel button and not '2' as I posted. Apart from that it works as described when I substitute my test template path for yours (and this error shouldn't have caused the process to crash, but would have completed the process whichever button you clicked.)

The buttons on the Userform only work as intended if you run the main macro and not the userform code.
__________________
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