PC Review


Reply
Thread Tools Rate Thread

Assign macro to WB-specific toolbar button?

 
 
Ian
Guest
Posts: n/a
 
      1st Mar 2007
In Excel 2000, s it possible to assign a macro to a toolbar button and make
that toolbar button visible (or active) ONLY when the book containing the
macro is active?

I've written a macro and assigned it to a toolbar button, but the button is
always visible and active.
--
Ian
--


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      1st Mar 2007
Private Sub Workbook_Activate()
Application.CommandBars("CB name").Controls("button name").Visible =
True
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("CB name").Controls("button name").Visible =
False
End Sub

This is ThisWorkbook code module code.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ian" <(E-Mail Removed)> wrote in message
news:2PzFh.35958$(E-Mail Removed)...
> In Excel 2000, s it possible to assign a macro to a toolbar button and
> make that toolbar button visible (or active) ONLY when the book containing
> the macro is active?
>
> I've written a macro and assigned it to a toolbar button, but the button
> is always visible and active.
> --
> Ian
> --
>
>
>



 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      1st Mar 2007
Thanks, Bob. This hides the button perfectly. It is the only button on a
custom toolbar. Is it possible to also hide the toolbar, such that it
reappears docked in the same place it was?

--
Ian
--
"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Private Sub Workbook_Activate()
> Application.CommandBars("CB name").Controls("button name").Visible =
> True
> End Sub
>
> Private Sub Workbook_Deactivate()
> Application.CommandBars("CB name").Controls("button name").Visible =
> False
> End Sub
>
> This is ThisWorkbook code module code.
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
> "Ian" <(E-Mail Removed)> wrote in message
> news:2PzFh.35958$(E-Mail Removed)...
>> In Excel 2000, s it possible to assign a macro to a toolbar button and
>> make that toolbar button visible (or active) ONLY when the book
>> containing the macro is active?
>>
>> I've written a macro and assigned it to a toolbar button, but the button
>> is always visible and active.
>> --
>> Ian
>> --
>>
>>
>>

>
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      1st Mar 2007
Just take out the control

Private Sub Workbook_Activate()
Application.CommandBars("CB name").Visible = True
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("CB name").Visible = False
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ian" <(E-Mail Removed)> wrote in message
news:2yBFh.42954$(E-Mail Removed)...
> Thanks, Bob. This hides the button perfectly. It is the only button on a
> custom toolbar. Is it possible to also hide the toolbar, such that it
> reappears docked in the same place it was?
>
> --
> Ian
> --
> "Bob Phillips" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Private Sub Workbook_Activate()
>> Application.CommandBars("CB name").Controls("button name").Visible =
>> True
>> End Sub
>>
>> Private Sub Workbook_Deactivate()
>> Application.CommandBars("CB name").Controls("button name").Visible =
>> False
>> End Sub
>>
>> This is ThisWorkbook code module code.
>>
>> --
>> HTH
>>
>> Bob
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my
>> addy)
>>
>> "Ian" <(E-Mail Removed)> wrote in message
>> news:2PzFh.35958$(E-Mail Removed)...
>>> In Excel 2000, s it possible to assign a macro to a toolbar button and
>>> make that toolbar button visible (or active) ONLY when the book
>>> containing the macro is active?
>>>
>>> I've written a macro and assigned it to a toolbar button, but the button
>>> is always visible and active.
>>> --
>>> Ian
>>> --
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      1st Mar 2007
So obvious, I don't know why I didn't think of it.

Thanks again, Bob.

--
Ian
--
"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Just take out the control
>
> Private Sub Workbook_Activate()
> Application.CommandBars("CB name").Visible = True
> End Sub
>
> Private Sub Workbook_Deactivate()
> Application.CommandBars("CB name").Visible = False
> End Sub
>
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
> "Ian" <(E-Mail Removed)> wrote in message
> news:2yBFh.42954$(E-Mail Removed)...
>> Thanks, Bob. This hides the button perfectly. It is the only button on a
>> custom toolbar. Is it possible to also hide the toolbar, such that it
>> reappears docked in the same place it was?
>>
>> --
>> Ian
>> --
>> "Bob Phillips" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Private Sub Workbook_Activate()
>>> Application.CommandBars("CB name").Controls("button name").Visible =
>>> True
>>> End Sub
>>>
>>> Private Sub Workbook_Deactivate()
>>> Application.CommandBars("CB name").Controls("button name").Visible =
>>> False
>>> End Sub
>>>
>>> This is ThisWorkbook code module code.
>>>
>>> --
>>> HTH
>>>
>>> Bob
>>>
>>> (there's no email, no snail mail, but somewhere should be gmail in my
>>> addy)
>>>
>>> "Ian" <(E-Mail Removed)> wrote in message
>>> news:2PzFh.35958$(E-Mail Removed)...
>>>> In Excel 2000, s it possible to assign a macro to a toolbar button and
>>>> make that toolbar button visible (or active) ONLY when the book
>>>> containing the macro is active?
>>>>
>>>> I've written a macro and assigned it to a toolbar button, but the
>>>> button is always visible and active.
>>>> --
>>>> Ian
>>>> --
>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      1st Mar 2007
Always works better with no control <bg>

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ian" <(E-Mail Removed)> wrote in message
news:dbCFh.24079$(E-Mail Removed)...
> So obvious, I don't know why I didn't think of it.
>
> Thanks again, Bob.
>
> --
> Ian
> --
> "Bob Phillips" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Just take out the control
>>
>> Private Sub Workbook_Activate()
>> Application.CommandBars("CB name").Visible = True
>> End Sub
>>
>> Private Sub Workbook_Deactivate()
>> Application.CommandBars("CB name").Visible = False
>> End Sub
>>
>>
>> --
>> HTH
>>
>> Bob
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my
>> addy)
>>
>> "Ian" <(E-Mail Removed)> wrote in message
>> news:2yBFh.42954$(E-Mail Removed)...
>>> Thanks, Bob. This hides the button perfectly. It is the only button on a
>>> custom toolbar. Is it possible to also hide the toolbar, such that it
>>> reappears docked in the same place it was?
>>>
>>> --
>>> Ian
>>> --
>>> "Bob Phillips" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Private Sub Workbook_Activate()
>>>> Application.CommandBars("CB name").Controls("button name").Visible =
>>>> True
>>>> End Sub
>>>>
>>>> Private Sub Workbook_Deactivate()
>>>> Application.CommandBars("CB name").Controls("button name").Visible =
>>>> False
>>>> End Sub
>>>>
>>>> This is ThisWorkbook code module code.
>>>>
>>>> --
>>>> HTH
>>>>
>>>> Bob
>>>>
>>>> (there's no email, no snail mail, but somewhere should be gmail in my
>>>> addy)
>>>>
>>>> "Ian" <(E-Mail Removed)> wrote in message
>>>> news:2PzFh.35958$(E-Mail Removed)...
>>>>> In Excel 2000, s it possible to assign a macro to a toolbar button and
>>>>> make that toolbar button visible (or active) ONLY when the book
>>>>> containing the macro is active?
>>>>>
>>>>> I've written a macro and assigned it to a toolbar button, but the
>>>>> button is always visible and active.
>>>>> --
>>>>> Ian
>>>>> --
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      2nd Mar 2007
I think I'm losing it <vbg>

--
Ian
--
"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Always works better with no control <bg>
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
> "Ian" <(E-Mail Removed)> wrote in message
> news:dbCFh.24079$(E-Mail Removed)...
>> So obvious, I don't know why I didn't think of it.
>>
>> Thanks again, Bob.
>>
>> --
>> Ian
>> --
>> "Bob Phillips" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Just take out the control
>>>
>>> Private Sub Workbook_Activate()
>>> Application.CommandBars("CB name").Visible = True
>>> End Sub
>>>
>>> Private Sub Workbook_Deactivate()
>>> Application.CommandBars("CB name").Visible = False
>>> End Sub
>>>
>>>
>>> --
>>> HTH
>>>
>>> Bob
>>>
>>> (there's no email, no snail mail, but somewhere should be gmail in my
>>> addy)
>>>
>>> "Ian" <(E-Mail Removed)> wrote in message
>>> news:2yBFh.42954$(E-Mail Removed)...
>>>> Thanks, Bob. This hides the button perfectly. It is the only button on
>>>> a custom toolbar. Is it possible to also hide the toolbar, such that it
>>>> reappears docked in the same place it was?
>>>>
>>>> --
>>>> Ian
>>>> --
>>>> "Bob Phillips" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Private Sub Workbook_Activate()
>>>>> Application.CommandBars("CB name").Controls("button name").Visible
>>>>> = True
>>>>> End Sub
>>>>>
>>>>> Private Sub Workbook_Deactivate()
>>>>> Application.CommandBars("CB name").Controls("button name").Visible
>>>>> = False
>>>>> End Sub
>>>>>
>>>>> This is ThisWorkbook code module code.
>>>>>
>>>>> --
>>>>> HTH
>>>>>
>>>>> Bob
>>>>>
>>>>> (there's no email, no snail mail, but somewhere should be gmail in my
>>>>> addy)
>>>>>
>>>>> "Ian" <(E-Mail Removed)> wrote in message
>>>>> news:2PzFh.35958$(E-Mail Removed)...
>>>>>> In Excel 2000, s it possible to assign a macro to a toolbar button
>>>>>> and make that toolbar button visible (or active) ONLY when the book
>>>>>> containing the macro is active?
>>>>>>
>>>>>> I've written a macro and assigned it to a toolbar button, but the
>>>>>> button is always visible and active.
>>>>>> --
>>>>>> Ian
>>>>>> --
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
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
Assign a specific codesnippet to a toolbar button. Hardy Microsoft C# .NET 0 8th Mar 2007 05:11 AM
assign macro to custom toolbar button =?Utf-8?B?Um9kIE5vbGFu?= Microsoft Outlook VBA Programming 1 7th Sep 2006 05:34 AM
How do I assign a macro to a toolbar/button using Word 2003? =?Utf-8?B?U29waGlzdGljYXQ=?= Microsoft Word Document Management 2 7th Jan 2005 01:59 PM
Assign macro to toolbar custom button? =?Utf-8?B?YW1lc2NoYQ==?= Microsoft Excel Programming 5 27th Sep 2004 05:31 PM
Assign a Macro to a Custom Toolbar Button =?Utf-8?B?U2hlaWxhIEEuIFJhbms=?= Microsoft Word Document Management 2 4th May 2004 02:41 AM


Features
 

Advertising
 

Newsgroups
 


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