View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Disabling Print on TOOLBAR

Instead of stopping the icon from working (and stopping ctrl-P and File|Print
and file|printpreview|Print,....)

maybe you could just set a global variable in a General module:

Option Explicit
Public OkToPrint As Boolean

Then within the workbook module, look at that boolean variable:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If OkToPrint = False Then
Cancel = True
MsgBox "Sorry--can't print now"
End If
End Sub

And when you're gonna allow printing, toggle it to true.

Chip Pearson has lots of stuff about events at:
http://www.cpearson.com/excel/events.htm

Dan Gesshel wrote:

Hello.

Okay... so maybe I was a little cocky, but I thought I had this solved.
I found out later I didn't.

I want to temporarily disable the Print button on the tool bar.
Unfortunately, it is forcing me provide the actual name of the Printer
on my network at the same time. For example my current code is:

CommandBars("Standard").Controls("Print (Marketing)").Enabled = False

This works great on my computer, but of course, not on anyone elses. I
need something that will disable it regardless of who is using it, and I
need it to work for both Excel 2000 and 2002 users. (Perhaps an idex
#??)

Can anyone help? I would appreciate it.

Thanks.

Dan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson