+ Reply to Thread
Results 1 to 2 of 2

Can't Exit Design Mode because CommandButton2 cannot be created

  1. #1
    Johnny Fugazzi
    Guest

    Can't Exit Design Mode because CommandButton2 cannot be created

    I am having problems with an excel workbook that was working fine
    previously.
    The sheet is quite large and has a couple of command buttons on it to
    trigger macros. I removed one of these buttons yesterday and saved the
    file.

    The worksheet now gives me an error whenever I move the mouse over one of
    the buttons that remain. The error is "Can't Exit Design Mode because
    CommandButton2 cannot be created".

    It appears that the CommandButton2 is still resident in my workbook
    somewhere, or is referenced in the code. I have looked through the VBA
    code and I do not see it anywhere, but it does show up in the object
    dropdown list at the top of the VB editior.

    Can someone please help me to clear out this residue?


    Thanks in advance



  2. #2
    Tom Ogilvy
    Guest

    Re: Can't Exit Design Mode because CommandButton2 cannot be created

    for each obj in Activesheet.OleObjects
    if typeof obj.Object is MSForms.Commandbutton
    msgbox obj.Name
    End if
    next

    if it finds it

    for each obj in Activesheet.OleObjects
    if typeof obj.Object is MSForms.Commandbutton
    if lcase(obj.name) = "commandbutton2" then
    obj.delete
    end if
    End if
    next

    --
    Regards,
    Tom Ogilvy

    "Johnny Fugazzi" <[email protected]> wrote in message
    news:[email protected]...
    > I am having problems with an excel workbook that was working fine
    > previously.
    > The sheet is quite large and has a couple of command buttons on it to
    > trigger macros. I removed one of these buttons yesterday and saved the
    > file.
    >
    > The worksheet now gives me an error whenever I move the mouse over one of
    > the buttons that remain. The error is "Can't Exit Design Mode because
    > CommandButton2 cannot be created".
    >
    > It appears that the CommandButton2 is still resident in my workbook
    > somewhere, or is referenced in the code. I have looked through the VBA
    > code and I do not see it anywhere, but it does show up in the object
    > dropdown list at the top of the VB editior.
    >
    > Can someone please help me to clear out this residue?
    >
    >
    > Thanks in advance
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1