Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default dynamic toolbar

I have a excel file that has an application open code in THISWORKBOOK. This
creates and populates a toolbar. However, I would like to be able to add a
(Pareto) button as part of the code that is triggered when one of the
original buttons on the bar is pressed. The way it is now, all pertinant
buttons are on the toolbar.
The reason I want to change it is because, while doing testing with a
coworker, he pressed the pareto button before the data in the sheet was
ready. One of the other buttons readies the input data for the pareto button.

To attempt to restate this, one of the buttons that is currently created
upon open, I want not to be visible until certain other macros are run.

Is it possible to go back and recreate an application event after it has run?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default dynamic toolbar

Why not just disable it and have your button that prepares the sheet enable
it as the last act.

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I have a excel file that has an application open code in THISWORKBOOK.

This
creates and populates a toolbar. However, I would like to be able to add

a
(Pareto) button as part of the code that is triggered when one of the
original buttons on the bar is pressed. The way it is now, all pertinant
buttons are on the toolbar.
The reason I want to change it is because, while doing testing with a
coworker, he pressed the pareto button before the data in the sheet was
ready. One of the other buttons readies the input data for the pareto

button.

To attempt to restate this, one of the buttons that is currently created
upon open, I want not to be visible until certain other macros are run.

Is it possible to go back and recreate an application event after it has

run?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default dynamic toolbar

I like the suggestion, Tom. But getting the code to add to the commandbar,
or even change the status of something on the bar is the problem. My
attempts to add code to my macro that will change the commandbar created as
an event is where I am struggling.

This is the code that I have tried:

With cbrCommandBar.Controls

Set cbcTypeParetoButton = .Add(msoControlButton)
'set properties of the Pareto command button.
With cbcTypeParetoButton
..Enabled = True
End With


"Tom Ogilvy" wrote:

Why not just disable it and have your button that prepares the sheet enable
it as the last act.

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I have a excel file that has an application open code in THISWORKBOOK.

This
creates and populates a toolbar. However, I would like to be able to add

a
(Pareto) button as part of the code that is triggered when one of the
original buttons on the bar is pressed. The way it is now, all pertinant
buttons are on the toolbar.
The reason I want to change it is because, while doing testing with a
coworker, he pressed the pareto button before the data in the sheet was
ready. One of the other buttons readies the input data for the pareto

button.

To attempt to restate this, one of the buttons that is currently created
upon open, I want not to be visible until certain other macros are run.

Is it possible to go back and recreate an application event after it has

run?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default dynamic toolbar

Sub DDDD()
Dim cbrCommandBar As CommandBar
Dim cbcTypeParetoButton As CommandBarButton
Set cbrCommandBar = Application.CommandBars("Custom 1")
With cbrCommandBar.Controls
On Error Resume Next
.Item("MyButton").Delete
On Error GoTo 0
Set cbcTypeParetoButton = .Add(msoControlButton)
End With
'set properties of the Pareto command button.
With cbcTypeParetoButton
.Enabled = True
.FaceId = 330
.Caption = "MyButton"
' .OnAction =
End With

End Sub

Worked fine for me.

--
Regards,
Tom Ogilvy


"Papa Jonah" wrote in message
...
I like the suggestion, Tom. But getting the code to add to the

commandbar,
or even change the status of something on the bar is the problem. My
attempts to add code to my macro that will change the commandbar created

as
an event is where I am struggling.

This is the code that I have tried:

With cbrCommandBar.Controls

Set cbcTypeParetoButton = .Add(msoControlButton)
'set properties of the Pareto command button.
With cbcTypeParetoButton
.Enabled = True
End With


"Tom Ogilvy" wrote:

Why not just disable it and have your button that prepares the sheet

enable
it as the last act.

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I have a excel file that has an application open code in THISWORKBOOK.

This
creates and populates a toolbar. However, I would like to be able to

add
a
(Pareto) button as part of the code that is triggered when one of the
original buttons on the bar is pressed. The way it is now, all

pertinant
buttons are on the toolbar.
The reason I want to change it is because, while doing testing with a
coworker, he pressed the pareto button before the data in the sheet

was
ready. One of the other buttons readies the input data for the pareto

button.

To attempt to restate this, one of the buttons that is currently

created
upon open, I want not to be visible until certain other macros are

run.

Is it possible to go back and recreate an application event after it

has
run?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default dynamic toolbar

Tom,
I don't understand how to incorporate your code. Should I be inserting this
at the point where I want the command bar to have the new button installed
(on the already existing toolbar)?
How does this code know when to add the new button?

TIA

"Tom Ogilvy" wrote:

Sub DDDD()
Dim cbrCommandBar As CommandBar
Dim cbcTypeParetoButton As CommandBarButton
Set cbrCommandBar = Application.CommandBars("Custom 1")
With cbrCommandBar.Controls
On Error Resume Next
.Item("MyButton").Delete
On Error GoTo 0
Set cbcTypeParetoButton = .Add(msoControlButton)
End With
'set properties of the Pareto command button.
With cbcTypeParetoButton
.Enabled = True
.FaceId = 330
.Caption = "MyButton"
' .OnAction =
End With

End Sub

Worked fine for me.

--
Regards,
Tom Ogilvy


"Papa Jonah" wrote in message
...
I like the suggestion, Tom. But getting the code to add to the

commandbar,
or even change the status of something on the bar is the problem. My
attempts to add code to my macro that will change the commandbar created

as
an event is where I am struggling.

This is the code that I have tried:

With cbrCommandBar.Controls

Set cbcTypeParetoButton = .Add(msoControlButton)
'set properties of the Pareto command button.
With cbcTypeParetoButton
.Enabled = True
End With


"Tom Ogilvy" wrote:

Why not just disable it and have your button that prepares the sheet

enable
it as the last act.

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I have a excel file that has an application open code in THISWORKBOOK.
This
creates and populates a toolbar. However, I would like to be able to

add
a
(Pareto) button as part of the code that is triggered when one of the
original buttons on the bar is pressed. The way it is now, all

pertinant
buttons are on the toolbar.
The reason I want to change it is because, while doing testing with a
coworker, he pressed the pareto button before the data in the sheet

was
ready. One of the other buttons readies the input data for the pareto
button.

To attempt to restate this, one of the buttons that is currently

created
upon open, I want not to be visible until certain other macros are

run.

Is it possible to go back and recreate an application event after it

has
run?






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
Dynamic pivot table linked to dynamic excel spreadsheets FErd Excel Worksheet Functions 0 April 29th 10 10:44 PM
Dynamic chart pasted to a new workbook in report can't be dynamic Piotr (Peter)[_2_] Charts and Charting in Excel 2 August 6th 08 05:15 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Charts and Charting in Excel 0 March 1st 06 01:05 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
Toolbar & dynamic filename Steven Excel Programming 1 June 3rd 04 04:01 PM


All times are GMT +1. The time now is 11:27 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"