Imports Docs.Word Public Class Sections_PageSetup Friend Shared Function Main1() As Document ' Open the document with given name Dim Doc As Document = Document.ReadDoc(Form1.SourceFolder + "Sections - PageSetup.doc") Dim PS As PageSettings = Doc.Sections(0).Style.PageSettings ' Change the page properties PS.PageHeight = 500 PS.PageWidth = 400 PS.Margins.Top = 25 PS.Margins.Left = 40 ' Create the page borders with given parameters PS.Borders = New Borders(1, BorderStyle.Dashed, Color.Red, 10) Return Doc End Function End Class