Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel 2003 macro problem in 2007 - can't select spinner or group box

Status
Not open for further replies.

owentmoore

Technical User
Jul 20, 2006
60
IE
I have a macro that selects a number of shapes including text boxes, rectangles, spinners and group boxes.

It works perfectly in excel 2003 but not in excel 2007. Using 2007 I get "run time error 1004, Application defined or object defined error". It looks like whenever I try to select the spinner or group box the error occurs.

Does anyone know why this is hte case and what I can do about it? The line of code that gives the error is as follows:

ActiveSheet.Shapes.Range(Array("Text Box 500", "Rectangle 482", "Group Box 474", "Spinner 475")).Select

Thanks
Owen



 


hi,

Please post your code in context.

Generally, using AcitiveAnything or Select are poor coding techniques.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
It looks like with excel 2007 you cannot select a form control and a shape at the same time. Trying to select a form control while a shape is selected deselects the shape in in order to select the form control - strange!

To get around this I've split my code into two separate lines, one selecting the from controls and one selecting the shapes and it works this way.

Thanks
Owen
 



Why Select anyhow??? It is not a particularly good coding device, generally.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip

I was using .Select to bring forward and send back certain shapes. Based on your comments i've moved away from .Select and am now using .Visible instead which actually workes much better for me.



Thanks
Owen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top