I'm calling my code from OnSubmitRequest, so I don't think I can use it again. Here is my current code. How do I reuse OnSubmitRequest?
<InfoPathEventHandler(EventType:=InfoPathEventType.OnSubmitRequest)> _
Public Sub OnSubmitRequest(ByVal e As DocReturnEvent)
StartSubmit()
End Sub
<InfoPathEventHandler(EventType:=InfoPathEventType.OnContextChange)> _
Public Sub OnContextChange(ByVal e As DocContextChangeEvent)
If mblnSubmit Then
FinishSubmit()
End If
End Sub
Private Sub StartSubmit()
mblnSubmit = True
thisXDocument.View.SwitchView("Print Version View 1")
End Sub
Private Sub FinishSubmit()
mblnSubmit = False
thisXDocument.View.Export("c:\MHT\temp.mht", "MHT")
thisXDocument.DataAdapters.Item("Main submit").Submit()
CloseInfoPath()
End Sub
Private Sub CloseInfoPath()
On Error Resume Next
thisApplication.Quit(True)
thisApplication.ActiveWindow.Close(True)
thisApplication.XDocuments.Close(thisXDocument)
thisXDocument.View.Window.Close(True)
End Sub