Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Including A Border In A Word Document

Status
Not open for further replies.

ndalli

Programmer
Nov 6, 1999
76
MT
Hi,<br>
<br>
I am writing to a word document and I need to put a Border around a number of lines. When I using the .borders.enabled = True in the selection part, the border is being done for all the page. On the other hand when I disable the border, all the borders will disappear.<br>
<br>
Can anybody please help on this?<br>
<br>
Thanks in advance
 
Have you tried using and formatting a table? I created this a few years ago (back on Word for Windows 3.x). It works fine in Word 97. You may be able to play with the border for the table to get what you need.<br>
<br>
WordBasic.LeftPara<br>
<br>
WordBasic.TableInsertTable ConvertFrom:=&quot;&quot;, NumColumns:=1, NumRows:=5, InitialColWidth:=&quot;Auto&quot;, Format:=&quot;0&quot;, Apply:=&quot;167&quot;<br>
<br>
WordBasic.Insert &quot;Text in Cell 1&quot;<br>
WordBasic.NextCell<br>
WordBasic.Insert &quot;Text in Cell 2&quot;<br>
WordBasic.NextCell<br>
<br>
If you can select the text you want to include in a border, you can do something like this:<br>
<br>
With Selection.ParagraphFormat<br>
With .Borders(wdBorderLeft)<br>
.LineStyle = wdLineStyleSingle<br>
.LineWidth = wdLineWidth050pt<br>
.ColorIndex = wdAuto<br>
End With<br>
With .Borders(wdBorderRight)<br>
.LineStyle = wdLineStyleSingle<br>
.LineWidth = wdLineWidth050pt<br>
.ColorIndex = wdAuto<br>
End With<br>
With .Borders(wdBorderTop)<br>
.LineStyle = wdLineStyleSingle<br>
.LineWidth = wdLineWidth050pt<br>
.ColorIndex = wdAuto<br>
End With<br>
With .Borders(wdBorderBottom)<br>
.LineStyle = wdLineStyleSingle<br>
.LineWidth = wdLineWidth050pt<br>
.ColorIndex = wdAuto<br>
End With<br>
With Options<br>
.DefaultBorderLineStyle = wdLineStyleSingle<br>
.DefaultBorderLineWidth = wdLineWidth050pt<br>
.DefaultBorderColorIndex = wdAuto<br>
End With<br>
<br>
Hope that helps!<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top