I have some code in a Microsoft Word .docm file that disables the save function and pops up a message:
Sub FileSave() MsgBox "Save is Disabled." & vbNewLine & "" & vbNewLine & "To save changes, use Save As." End Sub
This might be tricky but what I want to do now is disable that code, that is, to enable saving again, on a certain trigger event (when a user clicks a button).
When the document is first opened I have it so only save as is enabled, not save. After a certain event, I want save to work again.
I've gotten things like this to work, to programmatically add code to ThisDocument:
ThisDocument.VBProject.VBCompontents("ThisDocument").CodeModule.AddFromString "Private Sub Document_Close(): ActiveDocument.Saved = True: End Sub"
However I don't know if there is a way to edit or delete code, using other code.