Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Thanked 0 Times in 0 Posts

    Can I save copied document text as a text file? (Word 97)


    I am writing a program which parses text within a document and creates then saves a new document for each section of text.

    At present, the code looks like this:

    Application.Documents.Add (Visible:=False).Content.Paste
    Documents(1).SaveAs FileName:="TestDocument" & i & ".doc"

    The code is contained within a loop which loops through, parses and saves each section of the document.

    The problem I am having is creating a new document for each section of text and saving it is inefficient and slow. If possible, I would like to somehow just save the Section.Copy text as a text file without having to first add a document, copy the text into the new document, then save it.

    Is this possible? Any advice would be much appreciated [img]/forums/images/smilies/smile.gif[/img]


    -- Chris

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 93 Times in 89 Posts

    Re: Can I save copied document text as a text file? (Word 97)

    I don't think there's any way to write to a Word document without having it open. However, if you only care about unformatted text, you can blast out text files very quickly using either old-fashioned basic routines or the FileSystemObject.

    Here's a bizarre thought: you could create one new document and keep replacing its contents and using .SaveAs rather than adding and closing. Not the pinnacle of elegance, but if it saves half the overhead, why not?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts