Disable Print Facility

atmospheric

Well-known Member
Joined
Jul 16, 2002
Messages
565
I have a spreadsheet with a print button which allows the user to print only the parts I want them to see. I have removed the Printer icon on the toolbar, but does anyone know how to remove the Print option on the File menu? (File/Print)

Thanks in advance
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
That works great Kristy, but it disables the File/Print facility in ALL spreadsheets on my system. Is it possible to modify it so that it only effects the Sheet that it's written into?

Thanks in advance :pray:
 
Upvote 0
Can I resurrect this old post?

As I last stated, the solution in the link works perfectly, but it effects EVERY workbook I have. Is it possible to have it just effect the workbook that it's copied into?

Then, how can I disable the Right Click? :rolleyes:
 
Upvote 0
Based on the link, place this in your workbook module and see if it accomplishes what you are after. To easily access your workbook module, find the little Excel workbook icon near the upper left corner of your workbook window, usually just to the left of the File menu option. Right click on that icon, left click on View Code, and paste the following procedure into the large white area that is the workbook module. Press Alt+Q to return to the worksheet.



Private Sub Workbook_Open()
Run "DisableFileChoices"
End Sub


Private Sub Workbook_Activate()
Run "DisableFileChoices"
End Sub


Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Run "DisableFileChoices"
End Sub




Private Sub Workbook_BeforeClose(Cancel As Boolean)
Run "EnableFileChoices"
End Sub


Private Sub Workbook_Deactivate()
Run "EnableFileChoices"
End Sub


Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Run "EnableFileChoices"
End Sub





'This will disable the right click pop-up menu:

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
End Sub
 
Upvote 0
Thanks for the quick response Tom, but it keeps "erroring" on the last subroutine. With my basic knowledge of VBA I can't understand why.

Any suggestions please? :rolleyes:
 
Upvote 0
It's in "This Workbook (Code)" along with the full code from the link and your 6 subroutines. Is this correct?
 
Upvote 0
Just a thought:

isn't this enough ?
no need for changing menus, disable rightclick, etcetera ...
(perhaps I'm missing something)
kind regards,
Erik

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If button_used = False Then
MsgBox "only print with button", 48, "PRINTING CANCELLED"
Cancel = True
End If
End Sub

Code:
Public button_used As Boolean

Sub print_with_button()
button_used = 1
'printcode
button_used = 0
End Sub
 
Upvote 0
atmospheric said:
It's in "This Workbook (Code)" along with the full code from the link and your 6 subroutines. Is this correct?
The code I posted, and only the code I posted, would in fact go into the "ThisWorkbook" module. The code belonging to the link you posted would go into a standard module. If that's how you placed it all, it should work for you; it does for me.
 
Upvote 0

Forum statistics

Threads
1,214,541
Messages
6,120,110
Members
448,945
Latest member
Vmanchoppy

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