How can I delete accent mark form select character and whole text?

A

avkokin

I want to back of subject about set mark of accent (emphasis mark or
acunt accent).

How can I delete accent mark form select character and whole text?

I have next code:
Sub accent()
Dim selChar As Long
selChar = AscW(Selection.Range.Characters(1))
If Selection.Type = wdSelectionIP Then
MsgBox prompt:="Nothing selection", Title:="Select a character"
Else
' How delete accent mark?
With Selection
.Collapse direction:=wdCollapseEnd
.InsertSymbol CharacterNumber:=769, Unicode:=True
End With
End If
End Sub

Now I need delete Character (769) from selection text (if it exist).
How I can find it and delete it?
 
H

Helmut Weber

Hi,

a better solution is rather likely,
but as long as it isn't there...

Sub Test007C()
Dim rChr As Range
Dim sTmp As Range
Set sTmp = Selection.Range
For Each rChr In sTmp.Characters
If Len(rChr) = 2 Then
If AscW(Right(rChr, 1)) = 769 Then
rChr = Left(rChr, 1)
End If
End If
Next
End Sub

A character can have a length of 2!
In case of diacritics, the diacritic
is the right character,
or you may imagine that as a character behind a character.


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

avkokin

Hi,

a better solution is rather likely,
but as long as it isn't there...

Sub Test007C()
Dim rChr As Range
Dim sTmp As Range
Set sTmp = Selection.Range
For Each rChr In sTmp.Characters
If Len(rChr) = 2 Then
If AscW(Right(rChr, 1)) = 769 Then
rChr = Left(rChr, 1)
End If
End If
Next
End Sub

A character can have a length of 2!
In case of diacritics, the diacritic
is the right character,
or you may imagine that as a character behind a character.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

Hello Helmut.
Very very thank you! It's work! 3 days I found a solution.
Sincerely, Anton Kokin
 

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