FileSystemObject, ReadLine and Tabs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wendy Powley

    #1

    FileSystemObject, ReadLine and Tabs

    I am using a FileSystemObjec t to open a text file and the ReadLine
    method to read the file line by line.


    Set fs = CreateObject("S cripting.FileSy stemObject")
    Set ReptFile = fs.OpenTextFile (file, 1, 0)

    Reptln = ReptFile.ReadLi ne


    My file has tabs delimiting some of the values. It appears (from the
    debugger) that the tabs are being ignored, leaving me with a
    non-delimited line of text.

    Am I missing something here? I would like the tabs to remain and I
    don't want to convert my file before reading it via VB.

    Suggestions appreciated!

    Wendy Powley
    School of Computing
    Queen's University
    Kingston, ON
  • Tom van Stiphout

    #2
    Re: FileSystemObjec t, ReadLine and Tabs

    On 24 May 2004 20:17:27 -0700, wendy@cs.queens u.ca (Wendy Powley)
    wrote:

    That may be because of limitations of the debugger display. Try adding
    this after reading the line:
    debug.print Instr(Reptln, vbTab)

    Works for me: it correctly finds the tab characters.

    -Tom.
    [color=blue]
    >I am using a FileSystemObjec t to open a text file and the ReadLine
    >method to read the file line by line.
    >
    >
    > Set fs = CreateObject("S cripting.FileSy stemObject")
    > Set ReptFile = fs.OpenTextFile (file, 1, 0)
    >
    > Reptln = ReptFile.ReadLi ne
    >
    >
    >My file has tabs delimiting some of the values. It appears (from the
    >debugger) that the tabs are being ignored, leaving me with a
    >non-delimited line of text.
    >
    >Am I missing something here? I would like the tabs to remain and I
    >don't want to convert my file before reading it via VB.
    >
    >Suggestions appreciated!
    >
    >Wendy Powley
    >School of Computing
    >Queen's University
    >Kingston, ON[/color]

    Comment

    • Tom van Stiphout

      #3
      Re: FileSystemObjec t, ReadLine and Tabs

      On 24 May 2004 20:17:27 -0700, wendy@cs.queens u.ca (Wendy Powley)
      wrote:

      That may be because of limitations of the debugger display. Try adding
      this after reading the line:
      debug.print Instr(Reptln, vbTab)

      Works for me: it correctly finds the tab characters.

      -Tom.
      [color=blue]
      >I am using a FileSystemObjec t to open a text file and the ReadLine
      >method to read the file line by line.
      >
      >
      > Set fs = CreateObject("S cripting.FileSy stemObject")
      > Set ReptFile = fs.OpenTextFile (file, 1, 0)
      >
      > Reptln = ReptFile.ReadLi ne
      >
      >
      >My file has tabs delimiting some of the values. It appears (from the
      >debugger) that the tabs are being ignored, leaving me with a
      >non-delimited line of text.
      >
      >Am I missing something here? I would like the tabs to remain and I
      >don't want to convert my file before reading it via VB.
      >
      >Suggestions appreciated!
      >
      >Wendy Powley
      >School of Computing
      >Queen's University
      >Kingston, ON[/color]

      Comment

      Working...