Changing the "Replace Hyphens with Dash Option" from VBA

T

TC

In the menu under <Tools / AutoCorrect Options / AutoFormat As You
Type / Replace as you type>, there is an option called "Hyphens (--)
with Dash (-)". How can I change that option programmatically from
VBA?

While searching for the answer, I saw some documentation which says
the relevant property is

Application.Options.AutoFormatAsYouTypeReplaceFarEastDashes

However, I tried using that property, and it is obviously not correct.
Can anyone point me to the correct property?


-TC
 
H

Helmut Weber

Hi TC,

strange, but
if (!!!) recorded with chr(0150) as "-".

Sub Macro1()
AutoCorrect.Entries.Add Name:="--", Value:="–"
End Sub

seems to do the trick. ???

The surface in the VBA-editor doesn't reveal
the difference between chr(150) and chr(45)

Otherwise,

Sub Macro2()
AutoCorrect.Entries.Add Name:="--", Value:=Chr(150)
End Sub

HTH

--
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