Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Assign macro to WB-specific toolbar button?

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
--


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Assign macro to WB-specific toolbar button?

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" wrote in message
...
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
--





  #3   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Assign macro to WB-specific toolbar button?

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" wrote in message
...
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" wrote in message
...
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
--







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Assign macro to WB-specific toolbar button?

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" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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
--









  #5   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Assign macro to WB-specific toolbar button?

So obvious, I don't know why I didn't think of it.

Thanks again, Bob.

--
Ian
--
"Bob Phillips" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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
--













  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Assign macro to WB-specific toolbar button?

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" wrote in message
...
So obvious, I don't know why I didn't think of it.

Thanks again, Bob.

--
Ian
--
"Bob Phillips" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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
--













  #7   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Assign macro to WB-specific toolbar button?

I think I'm losing it <vbg

--
Ian
--
"Bob Phillips" wrote in message
...
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" wrote in message
...
So obvious, I don't know why I didn't think of it.

Thanks again, Bob.

--
Ian
--
"Bob Phillips" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 - assign macro to custom toolbar button Candace Excel Discussion (Misc queries) 1 August 10th 09 12:14 PM
Assign Add-In to Custom Toolbar Button Microsoft Office 2007 britt_04 Excel Discussion (Misc queries) 1 October 13th 08 09:57 PM
How Do I Assign a Toolbar Button to a Custom Number Format I creat FuadsCurse Excel Discussion (Misc queries) 3 March 27th 06 09:44 PM
How do I assign a toolbar button to a custom number format I creat FuadsCurse Excel Programming 1 March 27th 06 07:00 PM
Assign macro to toolbar custom button? amescha Excel Programming 5 September 27th 04 05:31 PM


All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"