Here follows a handy macro I’ve written for converting text written with Dual Greek Codepage to Unicode. Since I worked for a lot of firms operating internationally I’ve run into a lot of language and font issues. Here the solution to a common problem – converting legacy texts to unicode.
What are codepages and why should you care?
Why use Unicode?
Converting legacy text to Unicode
Attribute VB_Name = "Frankie_Macros"
Sub Convert_DualGreek()
Attribute Convert_DualGreek.VB_Description = "Converts DualGreek - Codepage 437 text to Unicode - www.frankie.bz"
Attribute Convert_DualGreek.VB_ProcData.VB_Invoke_Func = "Normal.Maico_Macros.Convert_DualGreek"
'
' Convert_Dual_Greek_to_Unicode Code Page Macro
'
' (C)2007 Frank Neulichedl
'
' Creative Commons 3.0 Attribution
'
Dim nDummy as Integer
Dim nOffset as Integer
nOffset=720 ' Change this for other codepages
For nDummy=180 to 210
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Chr(nDummy)
.Replacement.Text = ChrW(nDummy nOffset)
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Next
For nDummy=211 to 255
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Chr(nDummy)
.Replacement.Text = ChrW(nDummy nOffset)
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Next
' ---------- This section is for single special characters - to customize entirely
With Selection.Find
.Text = Chr(164)
.Replacement.Text = ChrW(8364)
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Chr(170)
.Replacement.Text = ChrW(890)
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Chr(175)
.Replacement.Text = ChrW(8213)
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
End Sub










