Stop printing Command Buttons on Userform

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
574
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm trying to prevent the commandbuttons on my userform from printing when I select the userform commandbutton. Below is the code I use, but the buttons still print. When I select the print button I can see it disappear while it's printing and then comes back after the print is sent to the printer, however it still prints with the commandbutton on the form.

VBA Code:
Private Sub cmdPrintJobStatus_Click()

    Me.cmdNotifyACCT4.Visible = False

    SaveImageActiveWindow

    AddTempWS

    Me.cmdNotifyACCT4.Visible = True

End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I'm guessing if this is waht you men.
You have a userform (probably with some data and a print button to print THAT userform?
So you copy the userform as imaga and print that and before you save the image you wanht the print button invisible?

Code:
Private Sub cmdPrintJobStatus_Click()
    Me.cmdNotifyACCT4.Visible = False
    Repaint
    SaveImageActiveWindow
    AddTempWS
    Me.cmdNotifyACCT4.Visible = True
    Repaint
End Sub
What the repaint button does is exactly that 'repaints' the userform and if it works the button will not be visible
 
Upvote 0
Solution
Thank you. I will give it a try and let you know how it goes...
 
Upvote 0
That worked great. Only problem I found was that if I select the print command button to print the userform a second time, most of the information on that form disappears.
 
Upvote 0
You'll have to check the code you have in the userform, all this does is repaint the form (that is not the same as refresh or initiate) so you will have to check what your pint command does more besides the action youasked for
 
Upvote 0
I just added a "Repaint" into what you sent me the first time as the very first line of the code and it did the trick. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,889
Members
449,193
Latest member
ronnyf85

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top