apostrophe

S

Steved

Hello from Steved

I'm using <[A-Za-z]@> to find the first word but if it has an apostrophe it
ignores and goes to the second word. How can I please include apostrophe.

Cheers.
 
H

Helmut Weber

Hi Steved,

without being able to discuss all details,
an apostrophe could be chr(39), chr(145) or chr(146).
Depending on your settings in:

tools
autocorrect options
autoformat as you type
replace as you type
straight quotes with smart quotes

So you have to provide for all of these, like:

Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "<[A-Z" & Chr(145) & Chr(146) & "'a-z]@>"
.MatchWildcards = True
While .Execute
rDcm.Select ' for testing
Wend
End With

Though, as I am thinking you're working
with simple txt-files,

.Text = "<[A-Z'a-z]@>"

might be sufficient.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top