0

This is my code in word vba macro

Public sub as2uni() Dim rdcm As Range Set rdcm = ActiveDocument.Range With rdcm.Find .MatchCase = True rdcm.Select .Text = "0079" .Replacement.Text = "\U0BB2" .Execute , , , , , , , , , , wdRepl End with End sub 

I just want to replace the ASC to Unicode in ALL my document, how can I do that?

0

1 Answer 1

1

I'm not sure I understand the purpose of your macro... I understand that you want to replace all capital "O" with the Latha-script formatted character ல

In that case, you need to change how you specify the Replace term. The ^Unnn format for Unicode is only valid for the "Find what" box. In order to figure this out, I copied and pasted the ல into the Replace box in Word's interface then executed the Find/Replace. Looking at the recorded code revealed you need to use the function ChrW to specify the Unicode representation in a macro.

In addition, you need to change how you specify searching ANSI 79, as below.

Public Sub as2uni() 'Latha Dim rdcm As Range Set rdcm = ActiveDocument.Range With rdcm.Find .ClearFormatting .MatchCase = True ' rdcm.Select .Text = "^79" .Replacement.Text = ChrW(2994) .Execute Replace:=wdReplaceAll End With End Sub 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.