Word XP to text 
Author Message
 Word XP to text

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.



Sun, 30 Jan 2005 08:59:43 GMT  
 Word XP to text
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.



Sun, 30 Jan 2005 10:04:42 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem opening text file from VBA in Word XP

2. _Office XP - Word to Outlook Text Formating - Please Help

3. _Office XP - Word to Outlook text formating -Please Help

4. Converting .doc Files to Text in Word XP Fails

5. Problem opening text file from VB in Word XP

6. Insert text into Word XP using VB.Net?

7. Automating Excel XP from Word XP

8. Word XP and Access XP

9. Word Templates with VBA code running very slow in Word XP

10. Office XP only: Spurious bookmark added to Word document Automating Powerpoint from Word

11. Word 97 Macros > Word XP Macros

12. Retrieving Word XP Metadata from a Word 97 document

 

 
Powered by phpBB® Forum Software