I'm automating word and opening a document. I'm intercepting the word apps document save event and trying to insert my own code. Problem is that the app and word hang every time I do this.
BUT! If I set a break point in the event and just F8 through it then everything works just fine. It's almost like the issue is timing and my code is executing too fast or something.
Here's a sample:
Private Sub WordApp_ApplicationEvents2_Event_DocumentBeforeSave(ByVal Doc As Word.Document, ByRef SaveAsUI As Boolean, ByRef Cancel As Boolean) Handles WordApp.ApplicationEvents2_Event_DocumentBeforeSave
'Intercept the save attempt and reroute to the database
MsgBox("Caught you!"
Cancel = True
End Sub
Thanks!
BUT! If I set a break point in the event and just F8 through it then everything works just fine. It's almost like the issue is timing and my code is executing too fast or something.
Here's a sample:
Private Sub WordApp_ApplicationEvents2_Event_DocumentBeforeSave(ByVal Doc As Word.Document, ByRef SaveAsUI As Boolean, ByRef Cancel As Boolean) Handles WordApp.ApplicationEvents2_Event_DocumentBeforeSave
'Intercept the save attempt and reroute to the database
MsgBox("Caught you!"
Cancel = True
End Sub
Thanks!