jasoncw
07-30-2007, 09:00 AM
I have a general question on command buttons. I do not want them to print. However, I do not see that they a "print object" format property as do the Excel command buttons, or a visible or hidden property. What is the proper way to hide these buttons on the document for printing purposes? I am currently just setting the height and width to 0, but it leaves a dot for each object on the printed document.
Code to intercept print events (Office 97):
Sub FilePrint()
'
' FilePrint Macro
' Prints the active document
'
If ThisDocument.ProtectionType = wdAllowOnlyFormFields Then _
ThisDocument.Unprotect
Call HideCommandButtons
Dialogs(wdDialogFilePrint).Show
Call UnhideCommandButtons
ThisDocument.Protect wdAllowOnlyFormFields, True
End Sub
Sub FilePrintDefault()
'
' FilePrintDefault Macro
' Prints the active document using the current defaults
'
If ThisDocument.ProtectionType = wdAllowOnlyFormFields Then _
ThisDocument.Unprotect
Call HideCommandButtons
ThisDocument.PrintOut
Call UnhideCommandButtons
ThisDocument.Protect wdAllowOnlyFormFields, True
End Sub
Code used to hide and unhide command buttons:
Sub HideCommandButtons()
'hides command buttons for printing
With ThisDocument.cmdCustomize
.Height = 0
.Width = 0
End With
With ThisDocument.cmdLetterhead
.Height = 0
.Width = 0
End With
End Sub
Sub UnhideCommandButtons()
'unhides command buttons
With ThisDocument.cmdCustomize
.Height = 23
.Width = 107
End With
With ThisDocument.cmdLetterhead
.Height = 23
.Width = 84.75
End With
End Sub
TIA
Jason
Code to intercept print events (Office 97):
Sub FilePrint()
'
' FilePrint Macro
' Prints the active document
'
If ThisDocument.ProtectionType = wdAllowOnlyFormFields Then _
ThisDocument.Unprotect
Call HideCommandButtons
Dialogs(wdDialogFilePrint).Show
Call UnhideCommandButtons
ThisDocument.Protect wdAllowOnlyFormFields, True
End Sub
Sub FilePrintDefault()
'
' FilePrintDefault Macro
' Prints the active document using the current defaults
'
If ThisDocument.ProtectionType = wdAllowOnlyFormFields Then _
ThisDocument.Unprotect
Call HideCommandButtons
ThisDocument.PrintOut
Call UnhideCommandButtons
ThisDocument.Protect wdAllowOnlyFormFields, True
End Sub
Code used to hide and unhide command buttons:
Sub HideCommandButtons()
'hides command buttons for printing
With ThisDocument.cmdCustomize
.Height = 0
.Width = 0
End With
With ThisDocument.cmdLetterhead
.Height = 0
.Width = 0
End With
End Sub
Sub UnhideCommandButtons()
'unhides command buttons
With ThisDocument.cmdCustomize
.Height = 23
.Width = 107
End With
With ThisDocument.cmdLetterhead
.Height = 23
.Width = 84.75
End With
End Sub
TIA
Jason