1,105,232 Community Members

Page borders

Member Avatar
pedders
Newbie Poster
12 posts since Jan 2013
Reputation Points: 7 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I'd like to programatically add a page border to a document being created.

The Macro code from Word is

  With Selection.Sections(1)
        With .Borders(wdBorderLeft)
            .LineStyle = wdLineStyleThinThickSmallGap
            .LineWidth = wdLineWidth300pt
            .Color = wdColorAutomatic
        End With
  End With

I can't fathom out how to convert this, if indeed it is possible, the only thing i seem to be able to come up with is some 3rd party add in (spire.doc) but don't have the funds for this.

Anyone with any ideas?

Thanks

Member Avatar
Begginnerdev
Veteran Poster
1,141 posts since Apr 2010
Reputation Points: 251 [?]
Q&As Helped to Solve: 191 [?]
Skill Endorsements: 15 [?]
 
0
 

You will need to look into using Word interopt.

Here is an example in C# and VB.Net

Here is an example in C#

A good C# to VB.NET converter can be found here.

Member Avatar
pedders
Newbie Poster
12 posts since Jan 2013
Reputation Points: 7 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks Beginnerdev but that solution is the 3rd party addon I specifically did not want to use as I don't have the funds for long term use of this particular addon (only a free trial).
I am already trying to use the Word.Interop but this particular function is evading me at present.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article