PC Review


Reply
Thread Tools Rate Thread

Assigning a button to a subroutine

 
 
Harry-Wishes
Guest
Posts: n/a
 
      23rd Jul 2009
Hello.

I created a custom toolbar which contains a single button. No sweat.

Now, is there a programmatic way to write a subroutine that can attach this
button to another subroutine. Maybe "assign to a suubroutine" is better
terminology. I have done an exhaustive hunt on the topic but I come up short.
Below, is a snippet of code where I created an object to the toolbar and the
button. This is as far as I've been able to go.

Dim ctlToggle As Office.CommandBarButton
Set ctlToggle = CommandBars("Letter_Toolbar").Controls(1)

Help appreciated as always.

Harry-Wishes
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      23rd Jul 2009
Saved from a previous post:

Your life will become much simpler if you include code to create the toolbar
when the workbook is opened and include code to destroy the toolbar when the
workbook is closed.

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

In xl2007, those toolbars and menu modifications will show up under the addins.

Harry-Wishes wrote:
>
> Hello.
>
> I created a custom toolbar which contains a single button. No sweat.
>
> Now, is there a programmatic way to write a subroutine that can attach this
> button to another subroutine. Maybe "assign to a suubroutine" is better
> terminology. I have done an exhaustive hunt on the topic but I come up short.
> Below, is a snippet of code where I created an object to the toolbar and the
> button. This is as far as I've been able to go.
>
> Dim ctlToggle As Office.CommandBarButton
> Set ctlToggle = CommandBars("Letter_Toolbar").Controls(1)
>
> Help appreciated as always.
>
> Harry-Wishes


--

Dave Peterson
 
Reply With Quote
 
Harry-Wishes
Guest
Posts: n/a
 
      24th Jul 2009
Works like a champ!
Great resource

Thanks!

Harry-Wishes



"Dave Peterson" wrote:

> Saved from a previous post:
>
> Your life will become much simpler if you include code to create the toolbar
> when the workbook is opened and include code to destroy the toolbar when the
> workbook is closed.
>
> For additions to the worksheet menu bar, I really like the way John Walkenbach
> does it in his menumaker workbook:
> http://j-walk.com/ss/excel/tips/tip53.htm
>
> Here's how I do it when I want a toolbar:
> http://www.contextures.com/xlToolbar02.html
> (from Debra Dalgleish's site)
>
> In xl2007, those toolbars and menu modifications will show up under the addins.
>
> Harry-Wishes wrote:
> >
> > Hello.
> >
> > I created a custom toolbar which contains a single button. No sweat.
> >
> > Now, is there a programmatic way to write a subroutine that can attach this
> > button to another subroutine. Maybe "assign to a suubroutine" is better
> > terminology. I have done an exhaustive hunt on the topic but I come up short.
> > Below, is a snippet of code where I created an object to the toolbar and the
> > button. This is as far as I've been able to go.
> >
> > Dim ctlToggle As Office.CommandBarButton
> > Set ctlToggle = CommandBars("Letter_Toolbar").Controls(1)
> >
> > Help appreciated as always.
> >
> > Harry-Wishes

>
> --
>
> Dave Peterson
>

 
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
Activate a moacro subroutine from a userform command button Roger on Excel Microsoft Excel Programming 1 27th Nov 2009 09:17 PM
Calling a subroutine with a command button JonV Microsoft Excel Programming 2 7th Jul 2008 10:45 PM
Run a subroutine from a worksheet without button, menu, or shortcut key… qpg Microsoft Excel Programming 2 12th Jun 2008 03:15 PM
Assigning name to button Grant Reid Microsoft Excel Programming 4 3rd Jun 2004 08:55 AM
Problem with toolbar button that points to a subroutine Keith Microsoft Powerpoint 4 4th Feb 2004 07:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:58 PM.