Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Dec 2000
    Thanked 0 Times in 0 Posts

    TextStream and FileSystem Objects (VBA in W2000 Vs W97)

    TextStream and File System Object
    or - should I upgrade my brain these holidays?

    Hi all,

    I have spent many years manipulating text files in VBA (and WordBasic before that) using syntax such as:

    Open MyFile For Input As #1 ; Line Input #1, inLine ...

    I am now working on a Word 2000 system and have stumbled across the Textstream, and file system objects (FSO). They seem useful for text files, but especially for things like checking if files/folders exist (I still find the DIR() function with vbDirectory attributes confusing!).

    Anyone have any comments or gotchas for this sort of upgrade? It seems a big learning investment but I suspect worth it in the end. I've been browsing the MSDN site, and have a copy of "VB and VBA in a Nutshell". Any other references worth getting?

    And is there any other interesting stuff that W2000 has that W97 didn't, that I really need to learn about?

    Margaret Hassall
    Melbourne, Australia

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

    Re: TextStream and FileSystem Objects (VBA in W2000 Vs W97)

    I *had* to learn some of it to code a solution in VBS for a machine that has no VBA host. If you read the code (attached), you can see how the approaches are not terribly different. (Pardon the lack of variable typing; VBS only has variants.) Here's a little comparison:
    <table border=1><td>VBA Old Style</td><td>VBS (to use in VBA, add blue text, remove red text)</td><tr><td>Dim FlNum As Integer
    FlNum = FreeFile
    Open strFileName For Input As #FlNum
    Attached Files Attached Files

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    New York, NY
    Thanked 29 Times in 27 Posts

    Re: TextStream and FileSystem Objects (VBA in W2000 Vs W97)

    Hi Margaret,

    I haven't worked with textstream objects, but as far as using FSO for file/directory functions, there's almost no learning curve - they're very simple.

    The references you mention are probably all you need.


Posting Permissions

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