Re: Assign Sub to Custom Button

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Tom Ogilvy (twogilvy_at_msn.com)
Date: 08/14/04


Date: Sat, 14 Aug 2004 12:50:34 -0400

You asked:

>How do I assign other
subroutines to those custom buttons through the programming?

In that vein, I would create the toolbar each time the workbook was opened
or if it is in an addin, each time excel was opened and the addin loaded.
Then you should know it is always pointing to the correct file to run the
macro.

-- 
Regards,
Tom Ogilvy
"Aggie94" <sspost@alpha1.net> wrote in message
news:ulWfLehgEHA.384@TK2MSFTNGP10.phx.gbl...
> I tried the OnAction property but it runs the associated sub at the time
the
> toolbar is built.  After that it does nothing.
>
> I am printing out the topic you provided but I have not had a chance to
look
> through it.  I'm sure the answer is there but I may be back.
>
> Thanks for the help.
>
> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
> news:e0tv5LggEHA.3948@TK2MSFTNGP11.phx.gbl...
> >   .OnAction = "MyMacro"
> >
> > use the onaction property of the button.
> >
> > http://msdn.microsoft.com/library/techart/ofcmdbar.htm
> >
> >
> >
> > -- 
> > Regards,
> > Tom Ogilvy
> >
> >
> > "Aggie94" <sspost@alpha1.net> wrote in message
> > news:e1dQL7bgEHA.2020@TK2MSFTNGP10.phx.gbl...
> > > How can I assign a particular Sub to a button that I create
> > > programmatically?  In other words, I have created a subroutine that
will
> > > create a custom toolbar and buttons on the user's computer.  It will
> > created
> > > (if it does not exist) or be made visible when a particular workbook
is
> > > opened and hidden when the workbook closes.  How do I assign other
> > > subroutines to those custom buttons through the programming?  None of
> the
> > > buttons will be for existing Excel functions.
> > >
> > >
> >
> >
>
>

Quantcast