Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Automation Error when deleting command bar button

Hi all
I've the following problem deleting a commandbutton in the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button (with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do but
this also remove all other customised settings of this bar)

Frank



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Automation Error when deleting command bar button

Hi Frank,

In the absence of a more constructive response,

Only resetting the complete commandbar would do but
this also remove all other customised settings of this bar)


Why not reset and rebuild the commandbar?


---
Regards,
Norman



"Frank Kabel" wrote in message
...
Hi all
I've the following problem deleting a commandbutton in the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button (with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do but
this also remove all other customised settings of this bar)

Frank





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Automation Error when deleting command bar button

Hi Norman
thanks for the response. The problem with this approach is
as follows:
- the button is inerted in the standard command bar
- the user may have other add-ins, etc. installed that
have changed the commandbar already
- so if I reset the commandbar all other 'customised' icos
would also be lost

Frank

-----Original Message-----
Hi Frank,

In the absence of a more constructive response,

Only resetting the complete commandbar would do but
this also remove all other customised settings of this

bar)

Why not reset and rebuild the commandbar?


---
Regards,
Norman



"Frank Kabel" wrote in message
...
Hi all
I've the following problem deleting a commandbutton in

the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button

(with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do

but
this also remove all other customised settings of this

bar)

Frank





.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automation Error when deleting command bar button

Have the macro that now shows the userform, instead show the userform using
a macro called with ontime.

Application.Ontime Now,"Macrotoshowform"

instead. This will allow the button's onaction code to complete and you can
delete the button with the userform.

--
Regards,
Tom Ogilvy

"Frank Kabel" wrote in message
...
Hi Norman
thanks for the response. The problem with this approach is
as follows:
- the button is inerted in the standard command bar
- the user may have other add-ins, etc. installed that
have changed the commandbar already
- so if I reset the commandbar all other 'customised' icos
would also be lost

Frank

-----Original Message-----
Hi Frank,

In the absence of a more constructive response,

Only resetting the complete commandbar would do but
this also remove all other customised settings of this

bar)

Why not reset and rebuild the commandbar?


---
Regards,
Norman



"Frank Kabel" wrote in message
...
Hi all
I've the following problem deleting a commandbutton in

the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button

(with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do

but
this also remove all other customised settings of this

bar)

Frank





.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Automation Error when deleting command bar button

Hi Tom
thanks - works perfectly!!

--
Regards
Frank Kabel
Frankfurt, Germany


Tom Ogilvy wrote:
Have the macro that now shows the userform, instead show the userform
using a macro called with ontime.

Application.Ontime Now,"Macrotoshowform"

instead. This will allow the button's onaction code to complete and
you can delete the button with the userform.


"Frank Kabel" wrote in message
...
Hi Norman
thanks for the response. The problem with this approach is
as follows:
- the button is inerted in the standard command bar
- the user may have other add-ins, etc. installed that
have changed the commandbar already
- so if I reset the commandbar all other 'customised' icos
would also be lost

Frank

-----Original Message-----
Hi Frank,

In the absence of a more constructive response,

Only resetting the complete commandbar would do but
this also remove all other customised settings of this

bar)

Why not reset and rebuild the commandbar?


---
Regards,
Norman



"Frank Kabel" wrote in message
...
Hi all
I've the following problem deleting a commandbutton in

the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button

(with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do

but
this also remove all other customised settings of this

bar)

Frank





.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Automation Error when deleting command bar button

Hi Frank,

Does the usedform need to be modal?

If ShowModal is set to false, the CommandButton can be deleted.


---
Regards,
Norman



"Frank Kabel" wrote in message
...
Hi all
I've the following problem deleting a commandbutton in the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button (with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do but
this also remove all other customised settings of this bar)

Frank





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Automation Error when deleting command bar button

Frank, after all the changes are made except for the button deletion, use an
Ontime command to run a macro that deletes the button.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Frank Kabel" wrote in message
...
Hi all
I've the following problem deleting a commandbutton in the
toolbar:
1. A customized commandbar button is created to invoke a
userform
2. Within the userform the user has the option to change
the commandbarbutton
3. To replace the button the procedure first tries to
delete the button and afterwards to add a new button (with
the new layout). For deleting the following statement is
used:
Application.CommandBars("Standard").Controls
("Button_Title").Delete

This returns an automation error if invoked from the
userform. No problem if invoked directly (e.g. from the
immediate window).
Problem seems to be that the commandbarbutton is
still 'pressed down' due to invoking the userform in the
first place and can therefore not be deleted.

Does anybody has an idea how to solve thisand how to
delete the button (even resetting the button does not
help. Only resetting the complete commandbar would do but
this also remove all other customised settings of this bar)

Frank





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
Deleting a Command Button Tdahlman Excel Discussion (Misc queries) 3 December 20th 07 08:34 PM
Deleting a Command Button from my Spreadsheet DDrowe Excel Discussion (Misc queries) 2 November 7th 06 01:49 PM
Command Button run-time error Dominique Feteau Excel Programming 1 June 29th 04 02:57 AM
Deleting some cells in a row using command button and offset Marvin Excel Programming 3 April 6th 04 02:36 AM
Run-time error on command button Phil Hageman[_3_] Excel Programming 4 November 4th 03 08:06 PM


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