Re: Format a file created by FSO.CreateTextFile?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Ed from AZ wrote:
I've got a very long file which is a string of docs that need to be
broken out and saved as individual docs. I can do this with either
Word's Document.Add and SaveAs or by using FSO.CreateTextFile.

I have to strike a balance between two issues, or find a better
solution altogether. The docs are formatted to look right in a
smaller mono-spaced font - I use Courier New, 10 pt. The files are
saved with a .doc extension and opened in Word (either 2003 or 2007).

If I create the files with Add, it takes 5-15 seconds per file, but I
can format them so they look right when opened. If I use FSO, it's
fractions of a second per file, but the file will use the Normal
default style - often Times 12 pt - when opening.

Is there a way to add font formatting to the FSO file? Or speed up
the doc saving? Or what about creating all files by FSO, then
accessing each doc in the folder and setting font characteristics?

The files you're creating with FSO are just pure text and nothing but text. No
formatting whatsoever. That's the very definition of "text files".

Btw, there's really no good excuse for using FSO in any language that has native
file i/o built-in. FSO is for scripting languages only, and is pathetically inept
(not to mention redundant overhead) compared to the language you're using.
--
..NET: It's About Trust!
http://vfred.mvps.org


.



Relevant Pages

  • Re: Format a file created by FSO.CreateTextFile?
    ... Is there a way to add font formatting to the FSO file? ... By default, when you open a text file in Word, the style named Plain Text is ...
    (microsoft.public.word.vba.general)
  • Format a file created by FSO.CreateTextFile?
    ... broken out and saved as individual docs. ... can format them so they look right when opened. ... Is there a way to add font formatting to the FSO file? ...
    (microsoft.public.word.vba.general)
  • Re: "scrrun.dll" not compatible in different languages?
    ... >That's a lot of code for something that should be built into the language. ... >C++ correctly handles the three most common end of line markers natively. ... - it supports delineated file reading and block input ... I suppose you know that the FSO will simply not work on well set up ...
    (microsoft.public.vb.general.discussion)