
Tips.Net > WordTips Home > Macros > Inserting a Paragraph from within a Macro
Summary: Macros are often used to process documents and make changes to them. This quick tip illustrates the macro code to use when you want to place and end-of-paragraph mark within the document. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
It is not unusual to use macros to insert new text within a document. One of the common pieces of text you may want to enter is a paragraph mark--the same as when you press Enter within a document. You can do this by using the following code within your VBA macro:
Selection.TypeParagraph
The TypeParagraph method is always used with the Selection object. As was mentioned, using TypeParagraph is the equivalent to pressing Enter in your document. This means that if anything was selected when the command is executed, the selection is replaced by the blank paragraph that the macro inserts.
Tip #1481 applies to Microsoft Word versions: 97 2000 2002 2003
More Power! For some people, the prospect of creating Word macros can be scary. WordTips: The Macros can help you conquer your fears and you'll discover you're much more confident and productive as you make Word do exactly what you want. This is an invaluable source for learning macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of WordTips. Learn at your own pace, exactly the way you want.
Check out WordTips: The Macros today!
If you provide support and help to others, you need the power offered in the WordTips Ten-Year Library. There is no better information repository anywhere! (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips