The information in this article applies to:
SUMMARYThe following macros show how to break up a multi-page document into separate files. The two macros use the Page or Section property of a Microsoft Word document to select and move through the document content. This code can be used in an automation scenario with Word not visible. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp Separate File by PageThe following macro copies text one page at a time and then saves that text in a new document. The macro uses the pre-defined bookmark "\page" and the document's built-in property of "number of pages".
Separate File by SectionThe following macro copies text one section at a time and then saves that text in a new document. The macro uses the pre-defined bookmark "\section" to create the new document. This macro is useful for breaking up a mail merge "Merge to New Document" file.
NOTE: When this code is used to select and copy the text content of the document, the header and footer are not retained. Styles, fonts, and layout may change if the main file and the new document are from different templates, but direct formatting is maintained. For more information about bookmarks, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type bookmark in the Office Assistant or the Answer Wizard, and then click Search to view the topic. For more information about browser, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type target property in the Office Assistant or the Answer Wizard, and then click Search to view the topic. Additional query words: vba split divide partition
Keywords : kbdta |
Last Reviewed: November 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |