PDA

View Full Version : [SOLVED:] Printing restriction



Kilroy
02-02-2017, 12:19 PM
I have a locked form that has 3 buttons (I do have the password)
1. does a spell check within text boxes.
2. adds a row to a table
3. Also adds a row to a table

I don't want the buttons to print.

I have looked all over for an answer to this.

Any help or guidance is appreciated.

gmaxey
02-02-2017, 04:32 PM
Sub PrintPreviewAndPrint()
HideCmdButtons
Application.ScreenRefresh
Dialogs(wdDialogFilePrint).Show
ShowCmdButtons
End Sub
Sub FilePrintDefault()
HideCmdButtons
ActiveDocument.PrintOut
ShowCmdButtons
End Sub
Private Sub HideCmdButtons()
Dim oButton As InlineShape
For Each oButton In ActiveDocument.InlineShapes
If oButton.Type = wdInlineShapeOLEControlObject Then
With oButton.PictureFormat
'.Brightness = 1
'.Contrast = 0
End With
End If
Next
End Sub
Private Sub ShowCmdButtons()
Dim oButton As InlineShape
For Each oButton In ActiveDocument.InlineShapes
If oButton.Type = wdInlineShapeOLEControlObject Then
With oButton.PictureFormat
.Brightness = 0.5
.Contrast = 0.5
End With
End If
Next
End Sub

Kilroy
02-03-2017, 06:47 AM
How do I link these subs to a "print command button?

gmaxey
02-03-2017, 07:59 AM
In your print command button code, call:

HideCmdButtons
'whatever other code you have
ShowCmdButtons

Kilroy
02-03-2017, 07:23 PM
Thanks Greg. Works great.