ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem removing controls (https://www.excelbanter.com/excel-programming/326322-problem-removing-controls.html)

Gixxer_J_97[_2_]

problem removing controls
 
i have programmatically deleted 'CommandButton2' from my sheet using

ActiveSheet.Shapes("CommandButton2").delete

now when i open my workbook i get the following:

Can't exit design mode because Control 'CommandButton2' can not be created

i can't find any references to command button 2 in my code (on this sheet) -
what do i do? I do have other commandbutton2's on other sheets.

if i try to rename one of my controls to CommandButton2 i get a

Ambiguous name detected: CommandButton2

gocush[_29_]

problem removing controls
 
Without seeing the code, it sounds like in your opening event you are trying
to create a command button for something and trying to name it
CommandButton2. Since you already have a CommandButton2 (even if it is on
another sheet) Excel wants to name the new button the next workbook-wide
number in sequence, say CommandButton14

This is just a guess from my past experience watching how excel names the
new buttons in a workbook.

"Gixxer_J_97" wrote:

i have programmatically deleted 'CommandButton2' from my sheet using

ActiveSheet.Shapes("CommandButton2").delete

now when i open my workbook i get the following:

Can't exit design mode because Control 'CommandButton2' can not be created

i can't find any references to command button 2 in my code (on this sheet) -
what do i do? I do have other commandbutton2's on other sheets.

if i try to rename one of my controls to CommandButton2 i get a

Ambiguous name detected: CommandButton2


Gixxer_J_97[_2_]

problem removing controls
 
i still wasn't able to figure out what the problem was. i didn't have an
open event and i'm not creating any controls - this problem started when i
saved a copy of the workbook, deleted all the vba out of the new workbook,
and then deleted the controls. as i was debugging i selected the wrong
workbook (thus changing active workbook) and it deleted the controls out of
my 'master' book.

i ended up going to a previous backup and copied over the code changes and
all seems to be ok.

J
"gocush" wrote:

Without seeing the code, it sounds like in your opening event you are trying
to create a command button for something and trying to name it
CommandButton2. Since you already have a CommandButton2 (even if it is on
another sheet) Excel wants to name the new button the next workbook-wide
number in sequence, say CommandButton14

This is just a guess from my past experience watching how excel names the
new buttons in a workbook.

"Gixxer_J_97" wrote:

i have programmatically deleted 'CommandButton2' from my sheet using

ActiveSheet.Shapes("CommandButton2").delete

now when i open my workbook i get the following:

Can't exit design mode because Control 'CommandButton2' can not be created

i can't find any references to command button 2 in my code (on this sheet) -
what do i do? I do have other commandbutton2's on other sheets.

if i try to rename one of my controls to CommandButton2 i get a

Ambiguous name detected: CommandButton2



All times are GMT +1. The time now is 01:29 PM.

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