Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Reading Text Files (VB 6.3/MSWord/2003)

    Hi there,

    I have created a template where I would like a combo-box to be populated by a .txt file which is stored in a network folder. Can anyone enlighten me as to how to deal with spaces in the .txt file? The format of the information held in the .txt file is as follows:

    1 - Acquisition Finance

    However, when I run the template, the population of the combo-box appears similar to:

    1
    -
    Acquisition
    Finance

    I have tried using quotes within the .txt file (i.e. "1 - Acquisition Finance") to no avail. Any help would be much appreciated.

    Thanks!

    Violet

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reading Text Files (VB 6.3/MSWord/2003)

    Can you post the code you are using to populate the combo box?

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Reading Text Files (VB 6.3/MSWord/2003)

    Hi Hans,

    Thanks for looking at this - believe it or not, I've managed to fix it myself!

    Thanks again,

    Violet

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading Text Files (VB 6.3/MSWord/2003)

    Violet

    This is interesting, and you have fixed your problem.
    Could you enlighten us on how you fixed it ?

    Useful information to others !

    Thanks in haste

  5. #5
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Reading Text Files (VB 6.3/MSWord/2003)

    Hi Dave,

    To be honest, I'm not entirely sure what I did!!!

    The vb used within the template is:

    Open "lraccode.txt" For Input As #9
    Do While Not EOF(9)
    Input #9, praccode
    Me.cmbprac_code.AddItem praccode
    Loop

    Within the .txt file, I enclosed all of the seperate lines (roughly 70) in quotes, i.e:

    "1 - Acquisition Finance"

    and that seemed to do the trick - as mentioned, we'd tried that before but it hadn't worked when we ran the template, however, a few days later it worked fine.

    Cheers,

    Violet

Posting Permissions

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