Hi John,
The following macro designed to save each letter created by a mailmerge as a
separate file, saves each section of the document as a separate file. If
you save a Word document as a text file, the header and footer text appears
at the bottom of the file, so if you modify this macro to save the document
at a text file, you would be somewhere near where you want to be
Sub splitter()
' splitter Macro
' Macro created 16-08-98 by Doug Robbins to save each letter created by a
mailmerge as a separate file.
Letters = ActiveDocument.Sections.Count
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
DocName = "Myletter" & LTrim$(Str$(Counter))
MsgBox DocName
ActiveDocument.Sections.First.Range.Cut
Documents.Add
Selection.Paste
ActiveDocument.SaveAs FileName:=DocName, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveWindow.Close
Counter = Counter + 1
Wend
If you put all of the files so created into a separate directory, the batch
processing macro that you will find in the article "How to Find & ReplaceAll
on a Batch of Documents in the Same Folder" at:
http://www.mvps.org/word/FAQs/MacrosVBA/BatchFR.htm
could be used to move the header text from being the second last item in
each document to being the first item.
Please post any response to the newsgroups for the benefit of others who may
also be following the thread.
Hope this helps,
Doug Robbins - Word MVP
Quote:
> I need to save Word Xp documents as plain text files with
> the header and footer information showing up with each
> page. (or at the least, at the start of each section they
> are in, provided I can identify them as a header or
> footer).
> I need to import the file into a separate program that
> only accepts plain text. Can anyone suggest a method to do
> this?
> Thanks.