Sei que você já tem uma função que retira acento, aliás, eu mesmo já postei uma solução destas por aqui. Mas sempre é bom olharmos para mais de uma solução:
Function ConvertAccent(ByVal inputString As String) As StringConst AccChars As String = _"²—–ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ'"Const RegChars As String = _"2---SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy'"Dim i As Long, j As LongDim tempString As StringDim currentCharacter As StringDim found As BooleanDim foundPosition As LongtempString = inputString' loop through the shorter stringSelect Case TrueCase Len(AccChars) <= Len(inputString)' accent character list is shorter (or same)' loop through accent character stringFor i = 1 To Len(AccChars)' get next accent charactercurrentCharacter = Mid$(AccChars, i, 1)' replace with corresponding character in "regular" arrayIf InStr(tempString, currentCharacter) > 0 ThentempString = Replace(tempString, currentCharacter, _Mid$(RegChars, i, 1))End IfNext iCase Len(AccChars) > Len(inputString)' input string is shorter' loop through input stringFor i = 1 To Len(inputString)' grab current character from input string and' determine if it is a special charcurrentCharacter = Mid$(inputString, i, 1)found = (InStr(AccChars, currentCharacter) > 0)If found Then' find position of special character in special arrayfoundPosition = InStr(AccChars, currentCharacter)' replace with corresponding character in "regular" arraytempString = Replace(tempString, currentCharacter, _Mid$(RegChars, foundPosition, 1))End IfNext iEnd SelectConvertAccent = tempStringEnd Function
Referências:
Tags: VBA, Outlook, email, anexar,