StripAccent.vba 584 B

123456789101112131415
  1. Function StripAccent(thestring As String)
  2. Dim A As String * 1
  3. Dim B As String * 1
  4. Dim i As Integer
  5. AccChars = "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ" & ChrW(337) & ChrW(369) & ChrW(336)
  6. RegChars = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy" & "o" & "u" & "O"
  7. For i = 1 To Len(AccChars)
  8. A = Mid(AccChars, i, 1)
  9. B = Mid(RegChars, i, 1)
  10. thestring = Replace(thestring, A, B)
  11. Next
  12. StripAccent = thestring
  13. End Function