shape runtime error 438 excel 2007

G

Guest

I couldn't get the Name of the parent of a shape.
In my codes I often use the parent.name expression to find out
In which sheet a shape is positioned.

e.g.
Sub mytest()

Dim curshape As Shape
With ActiveSheet

Set curshape = .Shapes.AddTextbox(msoTextOrientationHorizontal, 12, 12,
12, 12)
Debug.Print curshape.Parent.Name

End With

End Sub

This works in excel 2000 and 2003 without problems.

Is this a bug of excel 2007 or is there another solution to get such info?

THX
 
J

Jim Rech

I've had problems too with my code that manipulates shapes. I know that MS
has done a lot of work getting shapes to be more consistent across the
Office 2007 suite and that's created a few problems for us.

I found this code works in Excel 2003 and 2007:

Debug.Print curshape.DrawingObject.Parent.Name
 

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