Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Restricting Menus

I can't figure this out so perhaps someone here has some ideas...
The first two lines of code work and grey-out File-New and Edit-Cut.
The third line should grey-ouy Insert-Rows but it yields a Runtime
error '91': Object variable or With block variable not set. Any ideas
(Excel 97). Thanks in advance.

Sub RestrictMenus()
Application.CommandBars("File").FindControl(Id:=18 ).Enabled = False
Application.CommandBars("Edit").FindControl(Id:=21 ).Enabled = False
Application.CommandBars("Insert").FindControl(Id:= 296).Enabled = False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Restricting Menus

R

To be honest, I didn't know you could get to the File and Edit menus in that
fashion. Here's another way:

Application.CommandBars("Worksheet Menu
Bar").Controls("Insert").Controls("Rows").Enabled = False

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"R. Todd Miller" wrote in message
om...
I can't figure this out so perhaps someone here has some ideas...
The first two lines of code work and grey-out File-New and Edit-Cut.
The third line should grey-ouy Insert-Rows but it yields a Runtime
error '91': Object variable or With block variable not set. Any ideas
(Excel 97). Thanks in advance.

Sub RestrictMenus()
Application.CommandBars("File").FindControl(Id:=18 ).Enabled = False
Application.CommandBars("Edit").FindControl(Id:=21 ).Enabled = False
Application.CommandBars("Insert").FindControl(Id:= 296).Enabled = False
End Sub



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
Sub-menus of main menus for Excel 2007 Eleanor Peppard New Users to Excel 1 March 16th 10 04:12 PM
Creating Drop-down menus with subset drop-down menus Benjamin Excel Worksheet Functions 4 June 8th 09 11:27 PM
difference between word 2003 menus and word 2007 menus-Explain pl kali Excel Discussion (Misc queries) 1 August 29th 07 07:56 AM
New Menus - attaching but menus are reset Greegan Excel Worksheet Functions 0 November 5th 05 03:19 PM
Restricting use of menus and toolbars Brian Excel Programming 1 October 31st 03 04:51 PM


All times are GMT +1. The time now is 09:08 PM.

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"