VBA in Word code to delete or change code from ThisDocument -


i have code in microsoft word .docm file disables save function , pops message:

sub filesave() msgbox "save disabled." & vbnewline & "" & vbnewline & "to save changes, use save as." end sub 

this might tricky want disable that code, is, enable saving again, on trigger event (when user clicks button).

when document first opened have save enabled, not save. after event, want save work again.

i've gotten things work, programmatically add code thisdocument:

 thisdocument.vbproject.vbcompontents("thisdocument").codemodule.addfromstring "private sub document_close(): activedocument.saved = true: end sub" 

however don't know if there way edit or delete code, using other code.

a simpler way have variable of type boolean. when button clicked change value of boolean, , use conditional statement re-enable saving


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -