Hi,
This macro works closes the document fine except when initiated from a command button on a userform. Can someone help me figure out why and what I need to do to get it to work, please?
Macro:
Sub CloseDontSave()
Word.ActiveDocument.Close wdDoNotSaveChanges
End Sub
I have a command button on the doc that runs it and that's fine. I've created an AutoClose macro to show a userform if the user does not click any of the buttons provided. One of the buttons on the userform is also set to run this macro but bugs out when closing the doc.
Private Sub CommandButton3_Click()
UserForm2.Hide
Application.Run MacroName:="CloseDontSave"
End Sub
This is the error I get:
Run-time error '-2147352567 (80020009)':
Method 'Run' of object '_Application' failed