PC Review


Reply
Thread Tools Rate Thread

CommandBar issue

 
 
Geoff
Guest
Posts: n/a
 
      29th Feb 2008
Hi
I picked up on a response from J.Rech, 10/24/2007 to "Custom Commandbar,
Submenu questions". The solution of using a Tag to find controls worked for
me too - for a while.

The two adapted lines below have succesfully run hundreds of times from an
addin on 2 stand alone pcs. But for some unknown reason they do not work any
more.
They do not error out and I would appreciate ideas on how to fix the problem.

CommandBars.FindControl(Tag:="MakeB").Enabled = False
CommandBars.FindControl(Tag:="HypeF").Enabled = True

The code below is run to install a custom menu when a workbook is opened and
has not failed at all. After executing button 1 the idea is then to disable
it and enable button 2. The 2 disable / enable statements are called at the
end of the button 1 OnAction module.

T.I.A.

Geoff


Sub InstallPopUpMenu()

Dim button1 As CommandBarButton, button2 As CommandBarButton

'''try to delete old menus that may have been left by a crash.
On Error Resume Next
Application.CommandBars.ActiveMenuBar.Controls("Custom Tools").Delete
On Error GoTo 0

'''create custom menu
Set popupbar =
CommandBars.ActiveMenuBar.Controls.Add(Type:=msoControlPopup, _

Before:=CommandBars.ActiveMenuBar _

..Controls.Count, Temporary:=True)

popupbar.Caption = "&Custom Tools"

'''create buttons on menu
Set button1 = popupbar.CommandBar.Controls.Add(Type:=msoControlButton,
ID:=1)
With button1
.Caption = "&XXX"
.Style = msoButtonIconAndCaption
.FaceId = 642
.OnAction = "xx"
.Tag = "MakeB"
End With

Set button2 = popupbar.CommandBar.Controls.Add(Type:=msoControlButton,
ID:=1)
With button2
.Caption = "&ZZZ"
.Style = msoButtonIconAndCaption
.FaceId = 6915
.OnAction = "zz"
.Enabled = False
.Tag = "HypeF"
.BeginGroup = True
End With

popupbar.Visible = True

End Sub


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Commandbar issue Dale Fye Microsoft Access Form Coding 2 3rd May 2008 01:54 PM
CommandBar Issue - corrupt? =?Utf-8?B?Z29vZDEyZmluZA==?= Microsoft Access 0 12th Aug 2007 09:08 PM
Tag in CommandBar Desert Piranha Microsoft Excel Programming 3 9th Aug 2006 10:52 PM
CommandBar Frank Dulk Microsoft Access Forms 5 11th Mar 2005 08:06 AM
CommandBar Lynn Microsoft Excel Worksheet Functions 0 15th Sep 2003 01:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:03 PM.