Consulting

Results 1 to 4 of 4

Thread: Solved: Import Text problem

  1. #1

    Solved: Import Text problem

    Hi all,

    I want to import text file to excel, and I've got a problem ...

    I've used "\" as the delimiter, but this will cause the problem for the following lines:
    H \ 1 \ yes
    I \ 2 \ no
    J \ 3 \ no
    K \ 4 \ no
    N \ 7 \ yes \ no
    O \ 8 \ HGK \ GHG

    Indeed "yes \ no" & "HGK \ GHG" should be put together, if I divide it by "\", they will be seperated.

    N 7 yes no
    O 8 HGK GHG

    If I only take the first 2 "\" into account, can I use macro to help this? Thanks!!

    Desired Output:
    H 1 Yes
    I 2 No
    J 3 no
    K 4 no
    N 7 yes \ no
    O 8 HGK \ GHG

  2. #2
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Can I ask why \ is the delimiter? Do you have the option to change it to something else?

  3. #3
    Hi, because the original text file contains "\" and I can't change that.. I have no clue to solve it....

  4. #4
    VBAX Contributor
    Joined
    Jul 2005
    Posts
    169
    Location
    How are you importing?

    you can set the max splits with split function like
    if string is like

    O \ 8 \ HGK \ GHG

    split(string,"\",3)

    will give you O 8 HGK\CHG

Posting Permissions

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