I have an Excel file that pulls in data from a csv, manipulates it a bit, and then saves it down as a series of text files.
There are some special characters in the source data that trip things up so I added this to strip them out
Const SpecialCharacters As String = "!,@,#,$,%,^,&,*,(,),{,[,],},?,â,€,™"
Function ReplaceSpecialCharacters(myString As String) As String
Dim newString As String
Dim char As Variant
newString = myString
For Each char In Split(SpecialCharacters, ",")
newString = Replace(newString, char, "")
Next
ReplaceSpecialCharacters = newString
End Function
The issue is that this doesn't catch all of them. When I try to process the following text it slips through the above code and causes Excel to error out.
Hero’s Village
I think the issue is that the special character isn't being recognized by Excel itself. I was only able to get the text to look like it does above by copying it out of Excel and pasting it into a different IDE. In Excel is displays as:
Based on this site it looks like it's having issues displaying the ' character, but how do I get it to fix/filter it out if it can't even read it properly in VBA itself?



