PDA

View Full Version : Sub for user editing



Bert
05-10-2011, 10:06 PM
Hi guys,

Im trying to get word to run a sub based on when the user edits the document... I basically want it to check that they havent deleted a bookmark.

Im fine with everything in the sub but i cant work out if there is a sub that will active from deleting or editing text in the document.

Any help would be great.

Thanks
Bert

macropod
05-11-2011, 01:51 AM
Hi Bert,

There's no event Word can trap to tell whether a bookmark has been deleted (other than, perhaps, deletion via the Insert|Bookmark dialogue box).

gmaxey
05-11-2011, 04:47 PM
Not very elegant but maybe you can intercept the save command:

Sub FileSave()
If Not ActiveDocument.Saved Then
If ActiveDocument.Bookmarks.Exists("Test") Then
ActiveDocument.Save
Else
MsgBox "You have deleted a critical bookmark in this document which has disabled the save option."
Exit Sub
End If
Else
ActiveDocument.Save
End If
End Sub






Hi guys,

Im trying to get word to run a sub based on when the user edits the document... I basically want it to check that they havent deleted a bookmark.

Im fine with everything in the sub but i cant work out if there is a sub that will active from deleting or editing text in the document.

Any help would be great.

Thanks
Bert