srakasquared.blogg.se

How to insert page break in word 2016
How to insert page break in word 2016






  1. #HOW TO INSERT PAGE BREAK IN WORD 2016 MANUAL#
  2. #HOW TO INSERT PAGE BREAK IN WORD 2016 CODE#

When the script finishes running our Word document will look like this: Want to add a line break to the end of a sentence in a Microsoft Word document? Then use Chr(11) rather than the TypeParagraph() method.Īnd then, just for heck of it, we add a couple more paragraphs, one with a line break, one with a paragraph return.

#HOW TO INSERT PAGE BREAK IN WORD 2016 CODE#

What’s Chr(11)? As it turns out, that’s the ASCII code for a line break. However, we aren’t just adding a sentence we’re also adding Chr(11) to the end of that sentence. Once again we’re using the TypeText method to add a sentence to the document.

how to insert page break in word 2016

Now, take a look at the next piece of text we type into our document: objSelection.TypeText “This paragraph is followed by a line break.” & Chr(11) The first bit of text we add should look relatively familiar all we’re doing is using the TypeText method to type a sentence, then using the TypeParagraph() method to add a hard paragraph return (equivalent to pressing the ENTER key on the keyboard) at the end of that sentence: objSelection.TypeText “This paragraph is followed by a paragraph return.” Next we call the Add method in order to add a new, blank document to our instance of Word, then use the following line of code to create an instance of Word’s Selection object, something that positions the cursor at the beginning of the document and enables us to start adding text: Set objSelection = objWord.Selection As you can see, we start out the way most Microsoft Word scripts start out: we create an instance of the Word.Application object and then set the Visible property to True that gives us a running instance of Microsoft Word that we can see onscreen. Let’s explain how this script works and, along the way, show you a few pictures that should help convince you that it really does work. ObjSelection.TypeText “This paragraph is also followed by a line break.” & Chr(11) ObjSelection.TypeText “This paragraph is followed by a line break.” & Chr(11) ObjSelection.TypeText “This paragraph is followed by a paragraph return.”

#HOW TO INSERT PAGE BREAK IN WORD 2016 MANUAL#

In the meantime, and while we wait for our cappuccino, here’s a script that inserts a manual line break into a Microsoft Word document: Set objWord = CreateObject(“Word.Application”)








How to insert page break in word 2016