ShemeColor Shape/Group

Z

Zurn

Hello,
I want to change the view of shapes and groups. For individual shapes
get no error message, for groups I get the error that access is denie
for getting the colorfill of the group. What should I do?

Sub ShapeStatusChange()
Dim dashStat As MsoLineDashStyle
Dim colorStat As Integer
'On Error GoTo ShapeStatusChange_err
For Each sh In ActiveWindow.Selection.ShapeRange
dashStat = Selection.ShapeRange.Line.DashStyle
colorStat = Selection.ShapeRange.Fill.ForeColor.SchemeColor
'dash==>line==>yellow==>red==>dash
If dashStat = msoLineDash Then
......
end i
 
P

Peter T

I expect you have mixed colours in your group object. Some mixed formats
return -2 but mixed colours returns Null.

Suggest declare colorStat As Variant
If IsNull(colorStat) then colorStat = -2 ' for consistency

Apart from this I don't think your code does as intended. In the loop you
are always returning formats of the same entire selection.
For Each sh In ActiveWindow.Selection.ShapeRange
dashStat = Selection.ShapeRange.Line.DashStyle

For Each sh In ActiveWindow.Selection.ShapeRange
dashStat = sh.Line.DashStyle

Better also to declare sh as Shape

Regards,
Peter T
 

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