E
Elaine
I have the macro provided below which protects a document so that it cannot
be edited. However, when someone runs this file when it is already protected,
it gives an error message. I was wondering if someone could help me with a
statement that says something like:
If document is protected show message box indicating that document is
protected and when OK is clicked just go back to the document
If document is not protected then run the macro and save it to the M:\RayC
folder.
Thanks for your help.
===============
Sub Macro1()
'Protect Document
'Show File Open dialog box pointing to M:\RayC
'After user saves the file to a location Delete File from Original Location
Dim strdoc As String
strdoc = ActiveDocument.FullName
ActiveDocument.Protect Password:="raymondxc", NoReset:=False, Type:= _
wdAllowOnlyComments
'Show user File Open dialog box pointing to final replies and wait for him
to click OK
With Dialogs(wdDialogFileSaveAs)
.Name = "M:\RayC\" & ActiveDocument.Name
SendKeys "{Home}"
.Show
End With
'save file to do away with save changes dialog box
ActiveDocument.Save
'delete original file after it has been saved
Kill strdoc
End Sub
be edited. However, when someone runs this file when it is already protected,
it gives an error message. I was wondering if someone could help me with a
statement that says something like:
If document is protected show message box indicating that document is
protected and when OK is clicked just go back to the document
If document is not protected then run the macro and save it to the M:\RayC
folder.
Thanks for your help.
===============
Sub Macro1()
'Protect Document
'Show File Open dialog box pointing to M:\RayC
'After user saves the file to a location Delete File from Original Location
Dim strdoc As String
strdoc = ActiveDocument.FullName
ActiveDocument.Protect Password:="raymondxc", NoReset:=False, Type:= _
wdAllowOnlyComments
'Show user File Open dialog box pointing to final replies and wait for him
to click OK
With Dialogs(wdDialogFileSaveAs)
.Name = "M:\RayC\" & ActiveDocument.Name
SendKeys "{Home}"
.Show
End With
'save file to do away with save changes dialog box
ActiveDocument.Save
'delete original file after it has been saved
Kill strdoc
End Sub