Hi

Im using VBScript to work with MS Word with Word.Application. It opens Word,
writes some stuff, and saves the file.

In Word, if you type --- and the press enter, it turns it into a line that
goes right across the screen. How can I do this through automation? If I do..

oSel.TypeText "---"
oSel.TypeParagraph

..all i get is "---". If i try and record a macro to see how it works, it
doesnt do the line thing either! How can I draw this line across the page?

Cheers


Dan

Re: TypeText "---" TypeParagraph doesnt draw line by Miyahn

Miyahn
Tue Jan 25 10:59:22 CST 2005

"dhnriverside" wrote in message news:97A4548B-C872-4102-9B5D-FB2D013C2650@microsoft.com
> In Word, if you type --- and the press enter, it turns it into a line that
> goes right across the screen. How can I do this through automation? If I do..
>
> oSel.TypeText "---"
> oSel.TypeParagraph
>
> ..all i get is "---". If i try and record a macro to see how it works, it
> doesnt do the line thing either! How can I draw this line across the page?

Try this.
Const wdLineStyleSingle = 1
oSel.ParagraphFormat.Borders.insideLineStyle=wdLineStyleSingle

--
Miyahn (Masataka Miyashita) JPN
Microsoft MVP for Microsoft Office - Excel(Jan 2005 - Dec 2005)
HQF03250@nifty.ne.jp


Re: TypeText "---" TypeParagraph doesnt draw line by dan

dan
Tue Jan 25 11:49:03 CST 2005

Hi

Thanks - that almost works! In fact it does. Here's my code...

oSel.ParagraphFormat.Borders.innerLineStyle=1
oSel.TypeText "Client Agreement"
oSel.TypeParagraph

That works fine, however, it turns on the lines for every paragraph. If I
then turn the line off again, like so..

oSel.ParagraphFormat.Borders.innerLineStyle=0

..I dont get any lines. How do I stop the = 0 line from removing all the
lines (I only want one!)

Cheers


Dan


"Miyahn" wrote:

> "dhnriverside" wrote in message news:97A4548B-C872-4102-9B5D-FB2D013C2650@microsoft.com
> > In Word, if you type --- and the press enter, it turns it into a line that
> > goes right across the screen. How can I do this through automation? If I do..
> >
> > oSel.TypeText "---"
> > oSel.TypeParagraph
> >
> > ..all i get is "---". If i try and record a macro to see how it works, it
> > doesnt do the line thing either! How can I draw this line across the page?
>
> Try this.
> Const wdLineStyleSingle = 1
> oSel.ParagraphFormat.Borders.insideLineStyle=wdLineStyleSingle
>
> --
> Miyahn (Masataka Miyashita) JPN
> Microsoft MVP for Microsoft Office - Excel(Jan 2005 - Dec 2005)
> HQF03250@nifty.ne.jp
>
>

Re: TypeText "---" TypeParagraph doesnt draw line by dan

dan
Tue Jan 25 11:49:09 CST 2005

Hi

Thanks - that almost works! In fact it does. Here's my code...

oSel.ParagraphFormat.Borders.innerLineStyle=1
oSel.TypeText "Client Agreement"
oSel.TypeParagraph

That works fine, however, it turns on the lines for every paragraph. If I
then turn the line off again, like so..

oSel.ParagraphFormat.Borders.innerLineStyle=0

..I dont get any lines. How do I stop the = 0 line from removing all the
lines (I only want one!)

Cheers


Dan


"Miyahn" wrote:

> "dhnriverside" wrote in message news:97A4548B-C872-4102-9B5D-FB2D013C2650@microsoft.com
> > In Word, if you type --- and the press enter, it turns it into a line that
> > goes right across the screen. How can I do this through automation? If I do..
> >
> > oSel.TypeText "---"
> > oSel.TypeParagraph
> >
> > ..all i get is "---". If i try and record a macro to see how it works, it
> > doesnt do the line thing either! How can I draw this line across the page?
>
> Try this.
> Const wdLineStyleSingle = 1
> oSel.ParagraphFormat.Borders.insideLineStyle=wdLineStyleSingle
>
> --
> Miyahn (Masataka Miyashita) JPN
> Microsoft MVP for Microsoft Office - Excel(Jan 2005 - Dec 2005)
> HQF03250@nifty.ne.jp
>
>

Re: TypeText "---" TypeParagraph doesnt draw line by Miyahn

Miyahn
Tue Jan 25 17:12:06 CST 2005

"dhnriverside" wrote in message news:4B8A0DD6-2B87-4BB5-BA42-DC4166C0E79C@microsoft.com
> oSel.ParagraphFormat.Borders.innerLineStyle=1
> oSel.TypeText "Client Agreement"
> oSel.TypeParagraph
>
> That works fine, however, it turns on the lines for every paragraph. If I
> then turn the line off again, like so..
>
> oSel.ParagraphFormat.Borders.innerLineStyle=0
>
> ..I dont get any lines. How do I stop the = 0 line from removing all the
> lines (I only want one!)

Well, how about this?

Const wdCollapseEnd = 0, wdLineStyleSingle = 1
With Selection
.Collapse wdCollapseEnd
.ParagraphFormat.Borders.InsideLineStyle = wdLineStyleSingle
.TypeText "Client Agreement"
.Collapse wdCollapseEnd
.TypeParagraph
End With

--
Miyahn (Masataka Miyashita) JPN
Microsoft MVP for Microsoft Office - Excel(Jan 2005 - Dec 2005)
HQF03250@nifty.ne.jp