problem removing controls

G

Guest

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
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top