What's the shape type of drop boxes in VBA?

  • Hi,


    I have some code that is executed if a shape is placed in a specific spot on the worksheet. I accomplish this by checking Shape.TopLeftCell property for each of the shapes on the worksheet.


    The code works fine with "buttons" (rectangular shapes) I have on my sheet. However, apparently Excel treats a drop-down box I have on my sheet as a Shape object as well, and since apparently drop boxes don't support .TopLeftCell property my code errors out when it loops through the drop box Shape.


    What I want to do: add an IF statement to ignore the drop box shape so the code don't test it. But I can't seem to find the proper language for this - I was hoping to put in something along the lines of


    Code
    If Shape.Type = DropBox then
    Exit Sub


    Any suggestions would be appreciated.

  • Re: What's the shape type of drop boxes in VBA?


    If you are talking about a Drop Down from the Forms menu, its .Type is msoFormControl and its .FormControlType is xlDropDown.


  • Re: What's the shape type of drop boxes in VBA?


    Thanks Mike! I took a slightly different approach after all - in case someone has a similar question:


    Code
    If Shape.Name Like "Drop Down *" = False Then

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!