Article ID: 306348 - Last Review: January 31, 2007 - Revision: 4.2 How to programmatically save each page or section of a document as a separate fileThis article was previously published under Q306348 On This PageSUMMARY
The following macros show how to break up a multipage 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. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. Separate file by pageThe following macro copies text one page at a time and 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 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.For more information about how to use the sample code in this article, click the following article number to view the article in the Microsoft Knowledge Base: 290140
(http://support.microsoft.com/kb/290140/
)
How to run sample code for the Office XP programs from Knowledge Base articles
| Article Translations
|
Back to the top
