Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do you read in data that contains apostrophes (WordXP SP3)

    Hello

    I have data which Im searching for using an Instr.
    the data Im searching for contains apostrophes eg
    <viewentry position= "2"

    the actual number is dynamic and will change eg

    <viewentry position= "8"
    <viewentry position= "288"

    how do I include the apostrophe in my string?

    I have the following code:

    Dim strData As String
    Dim num As Long
    Dim strTemp As String
    Dim DTypePos As Long

    num = 2
    strData = "" & num & """"
    strTemp = "<viewentry position=" & strData

    DTypePos = InStr(1, XMLData, strTemp)

    this returns
    <viewentry position= 2""

    any ideas?
    or should O be doing this another way?
    diana

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

    Re: how do you read in data that contains apostrophes (WordXP SP3)

    Try this line for strData:
    <code>
    strData = """" & num & """"
    </code>
    or
    <code>
    strData = Chr(34) & num & Chr(34)
    </code>
    Chr(34) corresponds to a double quote <code>"</code>.

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17> An apostrophe is a single quote <code>'</code>

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: how do you read in data that contains apostrophes (WordXP SP3)

    thanks Hans

    that worked a treat!

    Diana <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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