Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    String issues... (word 2000, word 97)

    I have a string that has a lot of empty lines. I want to be able to delete the leading empty lines. For example I have a string (char(1000)), that has multiple lines seperated by (~r~n- end of line ) str ="<endofline character> <endofline character> <endofline character> Hello World!!".
    I want my resultant string to look like str = "Hello World!!". I am using VBA script to achieve this.

    Thanks,
    Sue

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

    Re: String issues... (word 2000, word 97)

    Try

    str = Replace(str, vbCrLf, "")

  3. #3
    New Lounger
    Join Date
    Aug 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: String issues... (word 2000, word 97)

    str = Replace(str, vbCrLf, "")
    This replaces ALL the end of line characters. I want to ONLY replace the leading end of line characters. By this I mean i i have a str say str = <eol><eol> Hello <eol>World!
    I want the result to be str = Hello <eol> World!

    Thanks,
    Sue

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

    Re: String issues... (word 2000, word 97)

    That wasn't clear from your original example. Try this instead:

    Do While Left(str, 2) = vbCrLf
    str = Mid(str, 3)
    Loop

Posting Permissions

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