Re: Word Shapes and Drawing Canvas
- From: "Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 6 Jun 2009 09:16:41 +1000
Maybe the following will avoid the error:
Dim i As Long
Dim srange As ShapeRange
With ActiveDocument
For i = 1 To .Shapes.Count
Set srange = .Shapes(i).CanvasItems.Range
srange.CanvasItems.SelectAll
If Selection.HasChildShapeRange = True Then
With Selection.ChildShapeRange.Line
.ForeColor = RGB(224, 107, 60)
.Weight = 1.5
End With
Else
MsgBox "This canvas contains no callouts to format."
End If
Next i
End With
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Jon Borel" <JonBorel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:62BD737E-4D16-4DF2-B3A7-B3785E6BB578@xxxxxxxxxxxxxxxx
Hi Doug,
Thanks a million!
I get a run-time error "This member can only be accessed for a group" with
the line
".Shapes(i).CanvasItems.SelectAll" indicated in yellow.
If you would explain what this error means, I would appreciate it; however,
I used "On Error Resume Next" as a workaround and your code works (otherwise)
perfectly!
Thanks again,
Jon
"Doug Robbins - Word MVP" wrote:
Try:
Dim i As Long
With ActiveDocument
For i = 1 To .Shapes.Count
.Shapes(i).CanvasItems.SelectAll
If Selection.HasChildShapeRange = True Then
With Selection.ChildShapeRange.Line
.ForeColor = RGB(224, 107, 60)
.Weight = 1.5
End With
Else
MsgBox "This canvas contains no callouts to format."
End If
Next i
End With
You may want to get rid of the Else
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Jon Borel" <JonBorel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BAA0E365-E829-4084-B32E-AE896FD2C369@xxxxxxxxxxxxxxxx
> Update,
>
> I've figured out out to update the line color of all of the shapes > (lines
> and boxes) that are in a canvas, but each canvas has to be selected
> manually:
>
> Selection.ShapeRange.CanvasItems.SelectAll
> If Selection.HasChildShapeRange = True Then
> With Selection.ChildShapeRange.Line
> .ForeColor = RGB(224, 107, 60)
> .Weight = 1.5
> End With
> Else
> MsgBox "This canvas contains no callouts to format."
> End If
>
> QUESTION: Is there a way to select all canvas objects at once, or for > Word
> to move from one to the next automatically? I'm looking for something
> along
> the lines of:
>
> Do while more canvas items exist
> 'Change the line colors using the code above
> Goto next canvas
> Loop
>
> "Jon Borel" wrote:
>
>> Hello,
>>
>> In Word 2003, I am trying to change the color of all Word Shapes >> (lines
>> and
>> boxes) from black to orange (RGB(224,107,60)). I can change the color >> of
>> the
>> shapes (lines and boxes) that are NOT in a Drawing Canvas using the
>> following
>> code:
>>
>> Sub UpdateCalloutLines()
>> ActiveDocument.Content.ShapeRange.Line.ForeColor = RGB(224, 107, >> 60)
>> End Sub
>>
>> What I can't figure out is how to update these same types of shapes
>> (lines
>> and boxes) when they occur in drawing canvasses.
>>
>> Any suggestions?
>>
>> Thanks,
>> Jon
.
- Follow-Ups:
- Re: Word Shapes and Drawing Canvas
- From: Jon Borel
- Re: Word Shapes and Drawing Canvas
- References:
- Word Shapes and Drawing Canvas
- From: Jon Borel
- RE: Word Shapes and Drawing Canvas
- From: Jon Borel
- Re: Word Shapes and Drawing Canvas
- From: Doug Robbins - Word MVP
- Re: Word Shapes and Drawing Canvas
- From: Jon Borel
- Word Shapes and Drawing Canvas
- Prev by Date: Re: Range object for "current line"
- Next by Date: Re: copy contents of clipboard into field code
- Previous by thread: Re: Word Shapes and Drawing Canvas
- Next by thread: Re: Word Shapes and Drawing Canvas
- Index(es):
Relevant Pages
|