PC Review


Reply
Thread Tools Rate Thread

Adding "Add-Ins..." control to custom tooolbar

 
 
Sandusky
Guest
Posts: n/a
 
      27th Sep 2007
Windows XP Pro SP2
Excel 2002 SP3

I have an AddIn that I created that creates a toolbar when the AddIn is
turned on, and I want to add the "Add-Ins..." control from the Tools menu to
this custom toolbar. I know I can get to the "Add-Ins..." control by

Dim MyCtrl as CommandBarsControl
Set MyCtrl = Application.CommandBars("Tools").Controls(15)

The problem arises when I try to copy to my custom toolbar (named
"MyToolbar") as I REALLY want to copy MyCtrl to a CommandBarPopup that is on
"MyToolbar".

So this is what I have

MyCtrl, the "Add-Ins..." control from the Tools menu
MyToolbar, created programmatically
MyMenu, a CommandBarPopup on MyToolbar

Any ideas?

Thanks!!

-gk-



 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      28th Sep 2007

gk,
You can use the "Copy" method to copy an existing control to a toolbar...

Sub PutHerThere()
Dim MyCtrl As CommandBarControl
Dim MyToolbar As CommandBar
Set MyCtrl = Application.CommandBars.FindControl(ID:=943) 'Add-Ins control
Set MyToolbar = Application.CommandBars.Add("TempBar", msoBarFloating, False, True)

MyCtrl.Copy bar:=MyToolbar
MyToolbar.Visible = True

Set MyCtrl = Nothing
Set MyToolbar = Nothing
End Sub

'Get rid of it...
Sub Goodbye()
Application.CommandBars("TempBar").Delete
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Sandusky"
wrote in message
Windows XP Pro SP2
Excel 2002 SP3
I have an AddIn that I created that creates a toolbar when the AddIn is
turned on, and I want to add the "Add-Ins..." control from the Tools menu to
this custom toolbar. I know I can get to the "Add-Ins..." control by

Dim MyCtrl as CommandBarsControl
Set MyCtrl = Application.CommandBars("Tools").Controls(15)

The problem arises when I try to copy to my custom toolbar (named
"MyToolbar") as I REALLY want to copy MyCtrl to a CommandBarPopup that is on
"MyToolbar".
So this is what I have

MyCtrl, the "Add-Ins..." control from the Tools menu
MyToolbar, created programmatically
MyMenu, a CommandBarPopup on MyToolbar

Any ideas?
Thanks!!
-gk-



 
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
Adding icon to the custom field using "olYesNo" Sanjay_S via OfficeKB.com Microsoft Outlook Contacts 2 12th Oct 2006 06:01 AM
Adding custom control to "personal-names" catagory in toolbox esakal Microsoft Dot NET 1 7th Sep 2006 03:13 PM
Adding "Entry Type" to custom Journal Form Geremy Havanec via OfficeKB.com Microsoft Outlook Form Programming 3 16th May 2005 08:20 PM
Hide "Record" "Closed Caption" "Parental Control" indicators while in full screen Jordan ATI Video Cards 0 18th Feb 2005 05:21 PM
Adding a custom "field" or word in Flag saturnin02 Microsoft Outlook 2 9th Aug 2004 05:22 PM


Features
 

Advertising
 

Newsgroups
 


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