[RESOLVED] Setting border on Coverpage ONLY
I'm using Visual Basic and i'm creating a Word doc and writing to it. I want page borders ONLY on page 1. I used the code below to create the page borders, but when I create them any page after the coverpage also has borders, which I dont want. I've read this thread(http://www.vbforums.com/showthread.p...=word+sections), but I cant figure out how to reference the second section. Any help would be appreciated.
Thanks
Code:
With objApp.Selection.Sections(1).Borders(WdBorderType.wdBorderLeft)
.LineStyle = WdLineStyle.wdLineStyleSingle
.LineWidth = WdLineWidth.wdLineWidth050pt
.Color = WdColor.wdColorBlack
End With
With objApp.Selection.Sections(1).Borders(WdBorderType.wdBorderRight)
.LineStyle = WdLineStyle.wdLineStyleSingle
.LineWidth = WdLineWidth.wdLineWidth050pt
.Color = WdColor.wdColorBlack
End With
With objApp.Selection.Sections(1).Borders(WdBorderType.wdBorderTop)
.LineStyle = WdLineStyle.wdLineStyleSingle
.LineWidth = WdLineWidth.wdLineWidth050pt
.Color = WdColor.wdColorBlack
End With
With objApp.Selection.Sections(1).Borders(WdBorderType.wdBorderBottom)
.LineStyle = WdLineStyle.wdLineStyleSingle
.LineWidth = WdLineWidth.wdLineWidth050pt
.Color = WdColor.wdColorBlack
End With
Re: Setting border on Coverpage ONLY
put the borders in the first page only header (the header can encompass the whole page)
same as you would a watermark
probably better to work with the document object rather than the selection
something like
Code:
With d.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Borders(wdBorderLeft)
where d is a document
you may also need to set the positions of the borders