Word2000 Macro and ^0132 quote

S

Sarunas

Hello,

I'm stuck with a problem. I have word 2000. For changing quotes in my
text to the ones used in my native language I wrote a macro. I've
testet it on Word97, Word2002 and Word2003 and it works perfectly. But
in Word2000 it doesn't.
If I'm typing opening guote like this ,, I use command ALT+0132 to get
it. This command works. But if I use this type of command (^0132 ) in
macro or in usual Repalce dialog it somehow converts my quote to the
closing one (which code is ALT+0147).
In macro I'm not using this type of line (.Text = """"), but using the
code (.Text = ChrW(8220)) but it doesnot works.
Here the code:

'
' Change ChrW(8220) quote to Lithuaninan opening quote
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ChrW(8220)
.Replacement.Text = "^0132"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

What is wrong here in word2000 when this piece of macro perfectly works
in every other version?

For closing quote (^0147) I'm using the second piece of macro
'
' Change ChrW(8221) quote to Lithuaninan closing quote
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ChrW(8221)
.Replacement.Text = "^0147"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Thanks for any suggestions.
 
G

Guest

Hello,

Not sure if this is what you are looking for (I couldn't get your code to
work on 2000 or 2003). Anyway...

First, the document needs to contain actual "smart" quotes". Not the
straight up and down quotes in which there is no actual right and left
(opening and closing).

Add to your code:
---------------------------
Dim QuotesSetting As Boolean

'pick up what the user has already set and store the TRUE or FALSE
' in the variable "QuoteSetting"
QuoteSetting = Options.AutoFormatAsYouTypeReplaceQuotes

'Change the user's setting to FALSE
Options.AutoFormatAsYouTypeReplaceQuotes = False
----------------------------------
PUT YOUR CODE HERE
----------------------------------
'This will set the user's options back to however they had it set before you
changed it
Options.AutoFormatAsYouTypeReplaceQuotes = QuoteSetting
-----------------------------------

Note that this is the very same setting that changes the dumb quotes to
smart quotes as you type.

I had also changed your replace code to:
....
..Text = ChrW(8220)
..Replacement.Text = ChrW(8222)
....
..Text = ChrW(8221)
..Replacement.Text = ChrW(8220)

Hope this helps.
 

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