With Word, can VBA identify chr(160) as an unbreakable space, different from chr(32), a normal space?

I am working with VBA in Word to analyze all the words in a given document and I want it to recognize numbers written as strings. My goal is to get the program to recognize that not only are "21" and  "twenty-one" numbers, but "vingt et un" and "ein und zwanzig" are numbers too. The program solves that by putting in unbreakable spaces to make such multi-word numbers single units that the program recognizes.
     My problem is that if I save the revised document so that I will not have to add those spaces the next time I run my program on the text, the program cannot see that "vingt@et@un" (where @ is an unbreakable space) is different from "vingt et un".  
     I do not want to change the spaces to some other character, because I want the document to look the same as it did before the program added the unbreakable spaces.
     I suspect the problem is unsolvable. Any suggestions to the contrary are most welcome.
     John Robin (in Priddis, Alberta)
JohnRobinAllenRetired professor of FrenchAsked:
Who is Participating?
Martin LissConnect With a Mentor Older than dirtCommented:
Sorry, it should be

If Asc(Mid$(MyString,MyCharacterPosition,1)) = 160 Then...
Martin LissOlder than dirtCommented:
If chr(Mid$(MyString,MyCharacterPosition,1)) = 160 Then...
JohnRobinAllenConnect With a Mentor Retired professor of FrenchAuthor Commented:
That is exactly what I wanted. Thanks.
     If it is of any interest to see how I implemented the solution, here is the code I used. Note that z() is a string array holding a series of expressions that have what should be unbreakable spaces. The "With Selection" and "With Find" are not closed since I need them for subsequent lines of code:
With Selection
            x = "vingt et un|trente et un|quarante et un|cinquante et un|ein und |zwei und |drei und |vier und und |fünf und |sechs und |sieben und |acht und |neun und |"
            x = x & "treinta y |cuarenta y |cincuenta y |sesenta y |setenta y |ochenta y |noventa y"
            z() = Split(x, "|")

            With .Find
                  .Forward = True
                  .MatchCase = False
                  For i = 0 To UBound(z)
                        Selection.HomeKey Unit:=wdStory
                        .Text = z(i)
                              If .Found Then
                                    If InStr(Selection, Chr(160)) = 0 Then
                                          .Text = " "
                                          .Replacement.Text = "^s"
                                          .Execute Replace:=wdReplaceAll
                                          .Text = z(i)
                                    End If
                              End If
                              If .Found = True Then
                                    Selection.Collapse wdCollapseEnd
                              End If
                        Loop While .Found
                  Next i

Open in new window

I consider the question now closed with full points awarded to Martin Liss.
     --JRA in Priddis, Alberta, Canada
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

JohnRobinAllenRetired professor of FrenchAuthor Commented:
I'm grateful to Martin, even though my implementation of his solution differed a bit from his. Because of my particular problem, I was able to simplify the solution..
Martin LissOlder than dirtCommented:
Please don't forget to select one or more answers and then close the question.
JohnRobinAllenRetired professor of FrenchAuthor Commented:
Sorry for the delay in closing this. I thought I had closed it. --j.r.a.
Martin LissOlder than dirtCommented:
I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.