From: spunkymuffmonkey on 26 Oct 2009 06:53 Hi. I have a command button within my document that present users with a userform. When this document is printed I have intercepted the print command with the following so that the command button is not printed: Sub FilePrint() With ActiveDocument If .ProtectionType <> wdNoProtection Then .Unprotect Password:="Gatekeeper1" End If End With ActiveDocument.InlineShapes(1).Delete ActiveDocument.FormFields("Text13").Delete Dialogs(wdDialogFilePrint).Show ActiveDocument.Undo 3 ActiveDocument.Protect NoReset:=True, Password:="Gatekeeper1", Type:=wdAllowOnlyFormFields My problem is that when the deleted inlineshape is 'undone', it is reinserted with an errant 1 on the end of the object name, for example 'CommandButton1' becomes 'CommandButton11', and I cannot find a way to programatically change it back. Any suggestions or help would be great. Many thanks
From: DaveLett on 26 Oct 2009 16:51 Hi, If all else fails, you could close the document and not save changes: ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges If you need the document open, you can reopen it. HTH, Dave
|
Pages: 1 Prev: Disable one image from printing in ms Word Next: Show/hide dropdown boxes |