DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: Hide Command Button in Word When Printing

DocumentBeforePrint event

in the app class module

Option Explicit
Public WithEvents appWord As Word.Application
 
Private Sub appWord_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
    Hide_Command_Button_in_Word_When_Printing
End Sub

enter image description here

Hide all command buttons - Mudule procedure

Sub Hide_Command_Button_in_Word_When_Printing()
    Dim cmdBtn As InlineShape
    Dim d As Document, ur As UndoRecord
    Set ur = Word.Application.UndoRecord

Top comments (0)