Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Arrary with Findcontrol

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Moody - 22 Mar 2006 20:50 GMT
Hi,
I have used the following code to disable all menu bar items except File and
Help. Is there a simpler way of writing this code. My code works but I am
just curious.

Any help is appreciated.

Regards
Moody
Moody - 22 Mar 2006 20:56 GMT
sorry forgot to add my code:
   With Application.CommandBars("Worksheet Menu Bar")
       .FindControl(ID:=30003).Enabled = False
       .FindControl(ID:=30004).Enabled = False
       .FindControl(ID:=30005).Enabled = False
       .FindControl(ID:=30006).Enabled = False
       .FindControl(ID:=30007).Enabled = False
       .FindControl(ID:=30011).Enabled = False
       .FindControl(ID:=30009).Enabled = False
       .FindControl(ID:=3, Recursive:=True).Enabled = False
       .FindControl(ID:=748, Recursive:=True).Enabled = False
       .FindControl(ID:=3823, Recursive:=True).Enabled = False
       .FindControl(ID:=846, Recursive:=True).Enabled = False
   End With

> Hi,
> I have used the following code to disable all menu bar items except File and
[quoted text clipped - 5 lines]
> Regards
> Moody
Doug Glancy - 22 Mar 2006 22:12 GMT
Moody,

Here's a start:

Sub test()

Dim find_control_array
Dim find_control

With Application.CommandBars("Worksheet Menu Bar")
   find_control_array = Array(30003, 30004) ' add the rest
   For Each find_control In find_control_array
       .FindControl(ID:=find_control).Enabled = False
   Next find_control
   'another loop here with the recursive argument
End With

End Sub

hth,

Doug Glancy

> sorry forgot to add my code:
>     With Application.CommandBars("Worksheet Menu Bar")
[quoted text clipped - 20 lines]
> > Regards
> > Moody
Moody - 22 Mar 2006 23:30 GMT
I tried and it works. Thanks a lot Doug, I appreciate your help.

> Moody,
>
[quoted text clipped - 45 lines]
> > > Regards
> > > Moody
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.