ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete a Commandbutton from another Workbook (https://www.excelbanter.com/excel-programming/330640-delete-commandbutton-another-workbook.html)

jase[_2_]

Delete a Commandbutton from another Workbook
 
Dear All,

What code do I use to reference and then delete a commandbutton that is
embedded on a worksheet in workbook(B).
The code has to go in a module in workbook(A).

Any help greatly appreciated
Jason


Ron de Bruin

Delete a Commandbutton from another Workbook
 
Hi jase

If the workbook is open you can use this for a control toolbox button

Workbooks("OtherWorkbook.xls").Sheets("Sheet1").OL EObjects("TheButton").Delete


--
Regards Ron de Bruin
http://www.rondebruin.nl



"jase" wrote in message oups.com...
Dear All,

What code do I use to reference and then delete a commandbutton that is
embedded on a worksheet in workbook(B).
The code has to go in a module in workbook(A).

Any help greatly appreciated
Jason




jase[_2_]

Delete a Commandbutton from another Workbook
 
cheers Ron


jase[_2_]

Delete a Commandbutton from another Workbook
 
so the OLEObjects collaction comprises all things embedded in
worksheets?


Dave Peterson[_5_]

Delete a Commandbutton from another Workbook
 
Nope. For instance, you can add controls from the Forms toolbar or shapes from
the Drawing toolbar. These aren't OLEObjects.

jase wrote:

so the OLEObjects collaction comprises all things embedded in
worksheets?


--

Dave Peterson

Tom Ogilvy

Delete a Commandbutton from another Workbook
 
to complement Dave's thought - all the items on the worksheet are in the
shapes collection.

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
Nope. For instance, you can add controls from the Forms toolbar or shapes

from
the Drawing toolbar. These aren't OLEObjects.

jase wrote:

so the OLEObjects collaction comprises all things embedded in
worksheets?


--

Dave Peterson





All times are GMT +1. The time now is 05:26 PM.

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