Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up How can I remove double quotations using Remove function in VBA?

    Hi

    I have tried using the Replace function to remove quotation marks but the string remains the same after running the Replace function

    I tried Replace(myString, """", "'") but this doesn't work.

    Can you please explain how I can do this?
    Last edited by rocket23; 2012-11-16 at 06:58. Reason: Corrected typo

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Are you sure you didn't intend to use Replace instead of Remove?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry I meant Replace. It was a typo. I corrected it.

    Thanks for noticing it

  4. #4
    New Lounger
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Solution

    I found the solution.

    The problem was the quotation mark character produced by some programs (this time in Outlook) is not always Character 34 (ASCII). So when I ask the Replace function to search for double q. marks it looks for Char(34) but actually the quotation marks I had in my string was Character 147 so VBA didn't see those characters as quotation marks.

    In other words, even though the double quotation mark character you type in Outlook looks like the same as the double quotation mark you type in VBA editor they are not. The VBA double quotation mark is Char(34) and the outlook one was Char(147) so the computer sees these characters differently.

    This forum post helped me to figure this out. It has a brief explanation.

    http://www.ilearnttoday.com/replace-...otation-in-vba

    Many thanks!

Tags for this Thread

Posting Permissions

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