Group: microsoft.public.word.vba.general
From: "Jonathan West"
Date: Tuesday, April 08, 2008 3:58 PM
Subject: Re: ending multiple if/with statements


"SHewes" wrote in message
news:5D411B29-2AA0-4D7D-828F-47B8F153A59F@microsoft.com...
> "Jonathan West" wrote:
>
>>
>> Such statement pairs should always be nested, not overlapping. It is
>> easier
>> to keep track if you indent code within these structures, as follows
>>
>> If A then
>> With B
>> With C
>> If D Then
>>
>> End If 'from If D
>> End With 'from With C
>> End With 'from With B
>> End If 'from If A
>>
>>
>
> I have never done Imbeded WITH statements before with Word. Is it possible
> to do so ??

Definitely! I use them often.

>
> For example you have
>
> With Selection.Range
> ...
> With Selection.Tables(1)
> ...
> .Font.Color = wdDarkBlue
> ...
> End With
> End With
>
> Whick of the two will have the .FONT.COLOR changed ???

The innermost one


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Safety Articles | Usenet Groups | Usenet News | Bluegrass