Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable Print button in Print Preview

Status
Not open for further replies.

sschrupp

Programmer
Feb 23, 2007
25
US
Is there a way to disable the "Print..." button in the Print Preview screen? In VBA I tried to use "ActiveSheet.PrintPreview EnableChanges:=False", but that didn't do anything. We are using Excel 2000.

Thanks!
Shane
 
Simple answer: NO

You could remove the button through Customize, but then there are a pile of problems you inherit.

Member- AAAA Association Against Acronym Abusers
 
You can remove the button from the toolbar. Use Tools > Customize while in Print Preview (or just press and hold Alt and drag it away).

I've never tried, but I guess you can disable it rather than remove it if you want - which application are you asking about?

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
You could presumably use the BeforePrint event to stop printing. And separately create a new macro / button to print.

Gavin
 
Thanks for the replies so far! Currently our users run a macro in Excel 2000 that eventually prints or faxes a report. Due to mysterious circumstances (read user error/meddling) the reports are sometimes formatted improperly. So they've requested the ability to preview the report to make sure this cosmic oddity hasn't occured before it gets sent off.

So what I was thinking of doing was introducing a msgbox asking if they'd like to preview the report before it prints. If yes it pops up the preview. After they close the preview I ask them if the report looks correct. If yes, continue the macro and print/fax. If no, halt the macro and direct them to the programmers.

The problem I forsee here is that the user might push the print button in the preview, and then when they close the preview the macro will continue and print it a second time.
 
I believe the BeforePrint does not work. If you try it, you will find BeforePrint activates before you can click Print Preview.

The only thing you could do is put in
Private Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox ("Have you closed Print Preview?")
End Sub


This will make you click on it twice and then let you print.

I believe the only VB code available for Print Preview is
ActiveWindow.SelectedSheets.PrintPreview


Member- AAAA Association Against Acronym Abusers
 
My apologies. You did say you were using Excel, I just didn't register it and replied with what you can do in Word. You should pay attention to xlhelp instead of me - I believe he's correct and Excel does not allow any kind of tweaking of the print preview window.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top