+ Reply to Thread
Results 1 to 6 of 6

Reinstating or ignoring Apostrophes

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Reinstating or ignoring Apostrophes

    I use this code to remove non-standard characters in my text :

    Please Login or Register  to view this content.
    It does the job well , but unfortunately it also replaces apostrophes in the text so that

    I'm becomes Im

    We'll becomes Well

    You're becomes Youre

    and so on.

    Can someone suggest a way to adapt the code so it doesn't remove apostrophes?

    Very grateful for any advice.

    Using Excel , Word and Access 2003 - For the whole of 2024

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Reinstating or ignoring Apostrophes

    I have not worked with word, but would it be possible to take out the apostrophe?"
    Please Login or Register  to view this content.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Reinstating or ignoring Apostrophes

    Is it replacing a plain apostrophe? '
    or a "smart" apostrophe?

  4. #4
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Reinstating or ignoring Apostrophes

    The code seems to be removing the "smart" apostrophe (’) you mention , rather than the simple one.

    The amendment by davesexcel above seems to be having an effect and leaves both in place.

    It occurs to me with this in mind that a search to replace the 'smart' with the 'simple' could work before the code above runs , but I'm having trouble enacting this in Word.

  5. #5
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Reinstating or ignoring Apostrophes

    As an update , It's no further forward presently.

    Although the the amendment by davesexcel in post 2 does leave apostrophes in place , it also leaves other non-standard characters in the text which it previously removed.

  6. #6
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Reinstating or ignoring Apostrophes

    The issue is being caused by the Auto-formatting of Straight quotes to Smart quotes.

    For the code in #1 to work consistently , the quotes in the text need to all be straight. Simply searching and replacing won't work , because Word will just autoformat back to Smart codes.

    This VBA turns of the autoformatting , runs the search and replace and then turns the autoformatting back on again.

    Please Login or Register  to view this content.

    The Autoformat function can be turned off and on manually ;

    Tools->AutoCorrect Options->AutoFormat As You Type tab->"Straight Quotes"
    with "Smart Quotes"

    and

    Tools->AutoCorrect Options->AutoFormat tab->"Straight Quotes"
    with "Smart Quotes"

    but the VBA takes care of it in a way that is not so long-winded.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Faster Way to Add Apostrophes
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2016, 09:06 PM
  2. Excel 2007 : using apostrophes in =IF( formula
    By chop924 in forum Excel General
    Replies: 4
    Last Post: 04-11-2012, 04:18 PM
  3. Excel 2007 : Removing Apostrophes
    By ameyabrid in forum Excel General
    Replies: 3
    Last Post: 08-30-2011, 11:35 AM
  4. Reinstating Data Labels in Legend
    By baby_rach in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-27-2009, 04:25 AM
  5. Why Apostrophes Don't Appear in Cell??
    By CrazyFileMaker in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-23-2009, 03:26 AM
  6. Apostrophes instead of equals in Excel
    By ARH in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. To clear apostrophes
    By Ben in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2005, 10:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1