W
wal
Vista
Office 2007
Sorry is this is a cross-post, but Google posted my query initially,
and then it disappeared.
I have a Document_Close sub (event) in ThisDocument in Normal that
saves the active document and then saves a backup in another location.
Before the ActiveDocument.Saved code at the top, I have the following
code in an attempt to avoid problems when closing a read-only file
without saving it as something; I just want to close it:
If ActiveDocument.ReadOnly = True Then
On Error GoTo Handler
Dim rYesponse
rYesponse = MsgBox("[instructions: Press OK to close the file
without saving; press Cancel to go back to the file and save it.]",
33, "Read-only file!!")
If rYesponse = vbOK Then
ActiveDocument.Saved = True [probably a superfluous line]
ActiveDocument.Close [ERROR 4198 appears here if handler code
omitted.]
Else:
Exit Sub
On Error GoTo 0
End If
On Error GoTo 0
End If
At the end, I have this code in a Handler:
If Err.Number = 4198 Then
On Error Resume Next
ActiveDocument.Close
On Error GoTo 0
End If
Even with the resume next line, error 4198 appears at the
ActiveDocument.Close line.
Anyway, how can I close the file without further ado. Thanks.
Office 2007
Sorry is this is a cross-post, but Google posted my query initially,
and then it disappeared.
I have a Document_Close sub (event) in ThisDocument in Normal that
saves the active document and then saves a backup in another location.
Before the ActiveDocument.Saved code at the top, I have the following
code in an attempt to avoid problems when closing a read-only file
without saving it as something; I just want to close it:
If ActiveDocument.ReadOnly = True Then
On Error GoTo Handler
Dim rYesponse
rYesponse = MsgBox("[instructions: Press OK to close the file
without saving; press Cancel to go back to the file and save it.]",
33, "Read-only file!!")
If rYesponse = vbOK Then
ActiveDocument.Saved = True [probably a superfluous line]
ActiveDocument.Close [ERROR 4198 appears here if handler code
omitted.]
Else:
Exit Sub
On Error GoTo 0
End If
On Error GoTo 0
End If
At the end, I have this code in a Handler:
If Err.Number = 4198 Then
On Error Resume Next
ActiveDocument.Close
On Error GoTo 0
End If
Even with the resume next line, error 4198 appears at the
ActiveDocument.Close line.
Anyway, how can I close the file without further ado. Thanks.