Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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). 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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a workaround: just change the For each... Next to For... Next. The
following works: Sub Play7() Dim shpS As Shape Dim N As Integer For N = 1 To Selection.ShapeRange.Count Set shpS = Selection.ShapeRange(N) With shpS Debug.Print shpS.Name Debug.Print shpS.ControlFormat.LockedText End With Next N End Sub This solution to the problem seems general, so this bug doesn't seem so critical as I originally thought. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Add csv to Open "All Excel Files" (XL2007) | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |