Hello

I have a macro which places text from a userform into various parts of a
document and (amazingly) it works except for one line which is to change the
style of a paragraph in the primary header of Section 2. This part works:

.Headers(wdHeaderFooterFirstPage).Range.Text = TxtReportTitle
.Headers(wdHeaderFooterPrimary).Range.Text = TxtReportTitle + Chr(13) +
"Table of Contents (continued)"

But this line doesn¹t:
'Selection.Style ActiveDocument.Styles("TOC continued")

All I want to do is change the Chr(13) and the next line into the
abovementioned style. I have tried changing ³Selection² to ³Range² but that
doesn¹t work either.

Can someone help me with the correct VB syntax for this?

Also, I¹d like to add a manual line break (^l) into my macro but I don¹t
know what the CHR code for that is. I understand that chr(13) is for
paragraph breaks (^p).

Thanks for any help.

Re: Changing a style in header by Jezebel

Jezebel
Tue Aug 23 15:59:44 CDT 2005

.Headers(wdHeaderFooterFirstPage).Range.Paragraphs(2).Style = "TOC
continued"


"Sol Apache" <Sol@solapache.com> wrote in message
news:BF3146FC.68E5%Sol@solapache.com...
> Hello
>
> I have a macro which places text from a userform into various parts of a
> document and (amazingly) it works except for one line which is to change
> the
> style of a paragraph in the primary header of Section 2. This part works:
>
> .Headers(wdHeaderFooterFirstPage).Range.Text = TxtReportTitle
> .Headers(wdHeaderFooterPrimary).Range.Text = TxtReportTitle + Chr(13) +
> "Table of Contents (continued)"
>
> But this line doesn¹t:
> 'Selection.Style ActiveDocument.Styles("TOC continued")
>
> All I want to do is change the Chr(13) and the next line into the
> abovementioned style. I have tried changing ³Selection² to ³Range² but
> that
> doesn¹t work either.
>
> Can someone help me with the correct VB syntax for this?
>
> Also, I¹d like to add a manual line break (^l) into my macro but I don¹t
> know what the CHR code for that is. I understand that chr(13) is for
> paragraph breaks (^p).
>
> Thanks for any help.
>



Re: Changing a style in header by Sol

Sol
Tue Aug 23 18:30:31 CDT 2005

Thank you very much, this works!


On 23/8/05 21:59, in article uy8bYWCqFHA.3520@tk2msftngp13.phx.gbl,
"Jezebel" <warcrimes@whitehouse.gov> wrote:

> .Headers(wdHeaderFooterFirstPage).Range.Paragraphs(2).Style = "TOC
>
> continued"
>
>
> "Sol Apache" <Sol@solapache.com> wrote in message
> news:BF3146FC.68E5%Sol@solapache.com...
>> Hello
>>
>> I have a macro which places text from a userform into various parts of a
>> document and (amazingly) it works except for one line which is to change
>> the
>> style of a paragraph in the primary header of Section 2. This part works:
>>
>> .Headers(wdHeaderFooterFirstPage).Range.Text = TxtReportTitle
>> .Headers(wdHeaderFooterPrimary).Range.Text = TxtReportTitle + Chr(13) +
>> "Table of Contents (continued)"
>>
>> But this line doesn¹t:
>> 'Selection.Style ActiveDocument.Styles("TOC continued")
>>
>> All I want to do is change the Chr(13) and the next line into the
>> abovementioned style. I have tried changing ³Selection² to ³Range² but
>> that
>> doesn¹t work either.
>>
>> Can someone help me with the correct VB syntax for this?
>>
>> Also, I¹d like to add a manual line break (^l) into my macro but I don¹t
>> know what the CHR code for that is. I understand that chr(13) is for
>> paragraph breaks (^p).
>>
>> Thanks for any help.
>>
>
>