A
Andrew M
Hi
I am doing a MS Office XP/2003 addin. However, one problem that makes me wonder is this one. I capture the DocumentBeforeSave Function and use this code. The problem if I respond to this function with a Cancel, or a No and then when I save, press Cancel, I get an Error 'Command Failed'
Am I just not doing this right or what?
Thanks
Andrew
Public Sub oApp_DocumentBeforeSave(ByVal Doc As Word.Document, SaveAsUI As Boolean, Cancel As Boolean)
' File Before Save
Dim intUserResponse As Integer
On Error GoTo ErrorHandler
If Doc.Name = "Normal.dot" Then Exit Sub
If m_blnImFiling = True Then
Exit Sub
End If
If m_blnIntegrate = True And m_blnSA_Int = True Then
'File to Foremost
intUserResponse = MsgBox("Would you like to file this document?", vbQuestion + vbYesNoCancel, "File Document?")
Select Case intUserResponse
Case vbCancel
Cancel = True
Case vbYes
Cancel = True
g_bln_SAflag = True
Case vbNo
'Do not File - Save Locally
SaveAsUI = True
Cancel = False
g_bln_SAflag = False
End Select
End If
Exit Sub
ErrorHandler:
ErrorReporter "Word_SaveAs", Error, Err, , True, True
Exit Sub
Resume
End Sub
I am doing a MS Office XP/2003 addin. However, one problem that makes me wonder is this one. I capture the DocumentBeforeSave Function and use this code. The problem if I respond to this function with a Cancel, or a No and then when I save, press Cancel, I get an Error 'Command Failed'
Am I just not doing this right or what?
Thanks
Andrew
Public Sub oApp_DocumentBeforeSave(ByVal Doc As Word.Document, SaveAsUI As Boolean, Cancel As Boolean)
' File Before Save
Dim intUserResponse As Integer
On Error GoTo ErrorHandler
If Doc.Name = "Normal.dot" Then Exit Sub
If m_blnImFiling = True Then
Exit Sub
End If
If m_blnIntegrate = True And m_blnSA_Int = True Then
'File to Foremost
intUserResponse = MsgBox("Would you like to file this document?", vbQuestion + vbYesNoCancel, "File Document?")
Select Case intUserResponse
Case vbCancel
Cancel = True
Case vbYes
Cancel = True
g_bln_SAflag = True
Case vbNo
'Do not File - Save Locally
SaveAsUI = True
Cancel = False
g_bln_SAflag = False
End Select
End If
Exit Sub
ErrorHandler:
ErrorReporter "Word_SaveAs", Error, Err, , True, True
Exit Sub
Resume
End Sub