Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disabling Toolbar buttons and CommandBar items

Hello,

I'm trying to disable the print CommandBar items and
toolbar buttons from a specific Excel workbook on the
WhenClick event of a custom button. The problem is that
in so ding, I end up disabling the functionality for any
workbook I open after executing my code. Any ideas on how
I can limit the sciope to the individual workbook I'm
working on? I'm sing Excel XP. Here's a snippet of my
code:

Toolbars("Standard").ToolbarButtons(7).Enabled = False

With CommandBars("File")
.Controls("Print...").Enabled = False
.Controls("Print Preview").Enabled = False
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Disabling Toolbar buttons and CommandBar items

Hi Jim

Rather than disabling the toolbar buttons (which can be easily overcome if a
User has other "custom" buttons on a toolbar, a better option may be to use
the following (which should be placed in the "ThisWorkbook" module) and
which will only effect the workbook you enter this code in.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub


--
XL2002
Regards

William


"Jim" wrote in message
...
| Hello,
|
| I'm trying to disable the print CommandBar items and
| toolbar buttons from a specific Excel workbook on the
| WhenClick event of a custom button. The problem is that
| in so ding, I end up disabling the functionality for any
| workbook I open after executing my code. Any ideas on how
| I can limit the sciope to the individual workbook I'm
| working on? I'm sing Excel XP. Here's a snippet of my
| code:
|
| Toolbars("Standard").ToolbarButtons(7).Enabled = False
|
| With CommandBars("File")
| .Controls("Print...").Enabled = False
| .Controls("Print Preview").Enabled = False
| End With


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disabling Toolbar buttons and CommandBar items

William,

Thanks for the great suggestion! It works like a charm.

Regards,
Jim



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

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to exchange Custom Commandbar buttons between PC's? Frank Van Eygen[_2_] Excel Discussion (Misc queries) 3 April 10th 09 01:01 PM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM
Toolbar Buttons Bob Phillips[_5_] Excel Programming 0 August 5th 03 10:34 PM
Disabling toolbar customization kb Excel Programming 0 July 29th 03 08:33 PM
Option buttons - disabling Ann Excel Programming 1 July 23rd 03 01:04 AM


All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"