
Tips.Net > WordTips Home > Macros > VBA Examples > Creating a New Document in VBA
Summary: You can create a brand new document within your VBA macro. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
One of the common things done during a macro is to create a new document. For instance, your macro could need the new document to hold processed text, or a different version of the document on which you are working.
To create a new document, simply include this line in your VBA macro:
Documents.Add
This creates a new document, based on Normal.Dot, adds it to the Documents collection, and makes the document active. This is the same as clicking the New button on the toolbar. If you want to create a new document based on a different template, simply use this command:
Documents.Add("MyTemplate.dot")
Tip #822 applies to Microsoft Word versions: 97 2000 2002 2003
Tremendous Table Tips! We often take tables for granted, but Word includes some very powerful ways you can present your tabular data. Discover how to make your tables better, easier to understand, and more effective.
Check out WordTips: Terrific Tables today!
It doesn't matter if you are a beginner or expert, the WordTips archives are the fastest way to improved productivity. (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