Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 16th, 2004, 10:39 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with FindControl

Hello All,

I'm trying to use FindControl to find a particular menu so that I can delete it. But if I try to find the menu by its tag, FindControl always returns "Nothing".

So, for example, if I do the following:

  Set HelpMenu = CommandBars(1).FindControl(Type:=msoControlPopup, _
    Tag:="Help")

the value of HelpMenu after executing this is "Nothing".

FindControl works as expected if I try to find a menu by its ID number, but this won't really help for what I need to do.

What am I doing wrong?

Thanks in advance for any assistance.

 
Old June 16th, 2004, 11:58 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you trying to reference the built-in Help popup menu in your example? If so, your code won't work because this control is not assigned a Tag value.

I don't think any built-in Office commandbar controls are assigned Tag values, in fact

You need to either use the ID parameter, or refer to it by it's key name in the collection. I've always done the former, by preference.

Code:
Set helpPopup = Application.CommandBars("Worksheet Menu Bar").FindControl(Id:=30010)
the above should work fine to locate the built-in Help popup.





Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl in DataListItem SKhna ASP.NET 2.0 Basics 1 February 29th, 2008 05:15 PM
using FindControl after ChangeMode in a FormView pbb ASP.NET 2.0 Basics 1 March 6th, 2007 10:11 AM
FindControl Wervis C# 7 November 30th, 2005 09:51 AM
FindControl dkr72 Excel VBA 0 January 19th, 2005 09:55 AM
FindControl Method problem jbenson001 ASP.NET 1.x and 2.0 Application Design 3 March 8th, 2004 10:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.