ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign macro to WB-specific toolbar button? (https://www.excelbanter.com/excel-programming/384259-assign-macro-wb-specific-toolbar-button.html)

Ian

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



Bob Phillips

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






Ian

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








Bob Phillips

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










Ian

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












Bob Phillips

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














Ian

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

















All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com