

For instance, don't use Selection without qualifying it. A - Insert a page break within the repetition section B - Or use paragraph options of Word to insert a page break before each new paragraph Example A - page break With the first option, the page break is repeated by the loop. But I dont know do this.'Replacement.Text' can only insert page break before / after the word 'Page'. Try adding a new paragraph mark (that is, press Enter) this will allow you to drag and drop the anchor if necessary so that you can insert the page break in the appropriate place. That means the document can be divided into 3 pages. You will have to carefully position the insertion point next to the paragraph mark on the page.

Actually, I want to move an insertion point to the front of the line that contains a word 'Page'.
#HOW TO INSERT PAGE BREAK IN WORD FROM CURRENT PAGE CODE#
Otherwise you run the risk of creating an extra Word.Application object that isn't controlled by you. I will create macro to run this code automatically in ACCESS application. If you want to run the code from another application without setting a reference to the Word object library, you must replace all Word-specific constants with their values, and take great care to make all objects refer back directly or indirectly to the

Set doc = Documents.Open("c:\report.txt") If you want to run this code from within Word, there is no need to create a Word.Application object: Sub InsertPageBreaks() Your code is a mixture between early binding (it refers to Word-specific constants such as wdParagraph) and late binding (word and doc are declared as objects). Selection.Collapse Direction:=wdCollapseEnd TX Text Control wont scroll automatically, if you insert a page break by code as this might be not the intention of the developer. Selection.MoveDown unit:=wdParagraph, Count:=1 If you insert a page break using the key combination CTRL + ENTER, TX Text Control scrolls automatically to this new input position. PageSetup.RightMargin = InchesToPoints("0.5") PageSetup.LeftMargin = InchesToPoints("0.5") PageSetup.Orientation = wdOrientLandscape Set word = CreateObject("word.application") But I don't know why page break only inserted before instead of the whole document. I'm trying to insert page break in a Word document with using VBA.
