G
Guest
Code using "ControlFormat" that worked in the previous version of Excel does
not work in Excel 2007.
In Excel 2007, start with a new worksheet, add an autoshape, such as an
oval, and select the shape. Run the following code (after removing the >'s
with Ctrl H).
The first and second print statements do fine. They print
True
Oval 1
The third produces an error:
"Object doesn't support this property or method."
This effectively makes ControlFormat unusable, because which shapes the user
selects can't be known in advance. (Anyone see a workaround?)
I also note that the variable varShape had to be declared as a variant. In
the previous version of Excel, it could be declared as a shape.
not work in Excel 2007.
In Excel 2007, start with a new worksheet, add an autoshape, such as an
oval, and select the shape. Run the following code (after removing the >'s
with Ctrl H).
Sub Play6()
Dim varShape As Variant
Dim shpS As Shape
Debug.Print Selection.ShapeRange(1).ControlFormat.LockedText
For Each varShape In Selection.ShapeRange
Debug.Print varShape.Name
Debug.Print varShape.ControlFormat.LockedText
Next varShape
End Sub
The first and second print statements do fine. They print
True
Oval 1
The third produces an error:
"Object doesn't support this property or method."
This effectively makes ControlFormat unusable, because which shapes the user
selects can't be known in advance. (Anyone see a workaround?)
I also note that the variable varShape had to be declared as a variant. In
the previous version of Excel, it could be declared as a shape.