
- #How to use office word to automaticly number each page how to#
- #How to use office word to automaticly number each page code#
OShape.Height = oWord.InchesToPoints(3.57) OShape.Width = oWord.InchesToPoints(6.25) 'Object model on the oChart object to make additional changes to the If desired, you can proceed from here using the Microsoft Graph :="", LinkToFile:=False, DisplayAsIcon:=False) Set oShape = oDoc.Bookmarks("\endofdoc").( _ Loop While Pos >= oRng.Information(wdVerticalPositionRelativeToPage) Set oRng = oDoc.Bookmarks("\endofdoc").Range ODoc.Bookmarks("\endofdoc").Range.InsertParagraphAfter OTable.Columns(2).Width = oWord.InchesToPoints(3) OTable.Columns(1).Width = oWord.InchesToPoints(2) 'Change width of columns 1 & 2. Set oTable = (oDoc.Bookmarks("\endofdoc").Range, 5, 2) 'Insert a 5 x 2 table, fill it with data and change the column widths. Set oPara4 = (oDoc.Bookmarks("\endofdoc").Range) OTable.Cell(r, c).Range.Text = "r" & r & "c" & c Set oTable = (oDoc.Bookmarks("\endofdoc").Range, 3, 5) 'Insert a 3 x 5 table, fill it with data and make the first row Set oPara3 = (oDoc.Bookmarks("\endofdoc").Range) Set oPara2 = (oDoc.Bookmarks("\endofdoc").Range) 'Insert a paragraph at the end of the document. 'Insert a paragraph at the beginning of the document. Set oWord = CreateObject("Word.Application") 'Start Word and open the document template.
#How to use office word to automaticly number each page code#
For Word 2000, click Microsoft Word 9.0 Object Library.Īdd the following code to the Click event for Command1: Dim oWord As Word.Applicationĭim oPara1 As Word.Paragraph, oPara2 As Word.Paragraphĭim oPara3 As Word.Paragraph, oPara4 As Word.Paragraph.

For Word 2002, click Microsoft Word 10.0 Object Library.For Word 2003, click Microsoft Word 11.0 Object Library.For Office Word 2007, click Microsoft Word 12.0 Object Library.On the Project menu, click References, click one of the following options, and then click OK: In Visual Basic, create a new Standard EXE project. To create a new Word document by using Automation from Visual Basic, follow these steps: Insert tables, format tables, and populate the tables with data.Browse and modify various ranges within a document.Insert paragraphs with text and formatting.
#How to use office word to automaticly number each page how to#
The sample code in this article demonstrates how to do the following: This step-by-step article describes how to create a new document in Word by using Automation from Visual Basic.
