Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Maintaining Macro Toolbar Button Properties

I am working in Excel 2003.

I have asigned a macro to a customer toolbar button which
is only available when a certain sheet in the workbook is
open. This button is on the standard toobar. I was able
to do this with the Worksheet_Activate and
Worksheet_Deactivate subroutines.

I made took the smiley face button from
View/Toolbars/Commands/Macros and drug it to the standard
toolbar. I did not create my own button.

On worksheet deactivation, the standard toolbar is reset
and the custom macro button goes away. However, each
time I reactivate the sheet and the button is placed back
on the toolbar, I have to reassign the macro to it and
also change the name from "Custom Buttom".

How do I get the custom button to retain its name and the
macro assigned to it?

Thanks,
Gary
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Maintaining Macro Toolbar Button Properties

hi,
I don't know if this has anything to do with it but is the
macro a sheet macro. that is a macro assigned to a sheet
and not the workbook or general.
I have never encountered this problem before. i usually
use button on the sheet to fire the macros.

-----Original Message-----
I am working in Excel 2003.

I have asigned a macro to a customer toolbar button which
is only available when a certain sheet in the workbook is
open. This button is on the standard toobar. I was able
to do this with the Worksheet_Activate and
Worksheet_Deactivate subroutines.

I made took the smiley face button from
View/Toolbars/Commands/Macros and drug it to the standard
toolbar. I did not create my own button.

On worksheet deactivation, the standard toolbar is reset
and the custom macro button goes away. However, each
time I reactivate the sheet and the button is placed back
on the toolbar, I have to reassign the macro to it and
also change the name from "Custom Buttom".

How do I get the custom button to retain its name and the
macro assigned to it?

Thanks,
Gary
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Maintaining Macro Toolbar Button Properties

Yes, it is a sheet macro. The macro for adding the
button is:

Private Sub Worksheet_Activate()
Application.CommandBars("Standard").Controls.Add _
Type:=msoControlButton, ID _
:=2950, Befo=6
End Sub

Nothing fancy, this is straight from recording the macro.

When the sheet is deactivated, I run:

Private Sub Worksheet_Deactivate()
Toolbars("Standard").Reset
End Sub

It seems to me there should be something added to the
Worksheet_Active macro that will automatically assign the
macro to the newly added button and also change the name
of the button from Custom Button to name I want, dist
list. I'm not sure how to do this.

Thanks,
Gary


-----Original Message-----
hi,
I don't know if this has anything to do with it but is

the
macro a sheet macro. that is a macro assigned to a sheet
and not the workbook or general.
I have never encountered this problem before. i usually
use button on the sheet to fire the macros.

-----Original Message-----
I am working in Excel 2003.

I have asigned a macro to a customer toolbar button

which
is only available when a certain sheet in the workbook

is
open. This button is on the standard toobar. I was

able
to do this with the Worksheet_Activate and
Worksheet_Deactivate subroutines.

I made took the smiley face button from
View/Toolbars/Commands/Macros and drug it to the

standard
toolbar. I did not create my own button.

On worksheet deactivation, the standard toolbar is

reset
and the custom macro button goes away. However, each
time I reactivate the sheet and the button is placed

back
on the toolbar, I have to reassign the macro to it and
also change the name from "Custom Buttom".

How do I get the custom button to retain its name and

the
macro assigned to it?

Thanks,
Gary
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Maintaining Macro Toolbar Button Properties

It is possible to assign macros to buttons at runtime.

I have CommandBar examples on my website.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Gary B" wrote in message
...
Yes, it is a sheet macro. The macro for adding the
button is:

Private Sub Worksheet_Activate()
Application.CommandBars("Standard").Controls.Add _
Type:=msoControlButton, ID _
:=2950, Befo=6
End Sub

Nothing fancy, this is straight from recording the macro.

When the sheet is deactivated, I run:

Private Sub Worksheet_Deactivate()
Toolbars("Standard").Reset
End Sub

It seems to me there should be something added to the
Worksheet_Active macro that will automatically assign the
macro to the newly added button and also change the name
of the button from Custom Button to name I want, dist
list. I'm not sure how to do this.

Thanks,
Gary


-----Original Message-----
hi,
I don't know if this has anything to do with it but is

the
macro a sheet macro. that is a macro assigned to a sheet
and not the workbook or general.
I have never encountered this problem before. i usually
use button on the sheet to fire the macros.

-----Original Message-----
I am working in Excel 2003.

I have asigned a macro to a customer toolbar button

which
is only available when a certain sheet in the workbook

is
open. This button is on the standard toobar. I was

able
to do this with the Worksheet_Activate and
Worksheet_Deactivate subroutines.

I made took the smiley face button from
View/Toolbars/Commands/Macros and drug it to the

standard
toolbar. I did not create my own button.

On worksheet deactivation, the standard toolbar is

reset
and the custom macro button goes away. However, each
time I reactivate the sheet and the button is placed

back
on the toolbar, I have to reassign the macro to it and
also change the name from "Custom Buttom".

How do I get the custom button to retain its name and

the
macro assigned to it?

Thanks,
Gary
.

.



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
Macro button on toolbar Daniel Charts and Charting in Excel 0 August 27th 07 08:56 PM
Button with macro in toolbar Daniel Charts and Charting in Excel 1 August 25th 07 02:39 AM
Macro button on toolbar Lesley Excel Discussion (Misc queries) 2 August 28th 06 07:32 PM
Macro Toolbar Button Gary Excel Programming 1 September 29th 04 01:35 PM
Toolbar button To Run a Macro? jon Excel Programming 1 November 17th 03 07:07 PM


All times are GMT +1. The time now is 04:43 AM.

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

About Us

"It's about Microsoft Excel"