How to Remove Accents in a VB6 String
- 1). Create a new Standard EXE Visual Basic program. Add the ability to read and process data from an external file by selecting "Project" and "References." Check the box next to "Microsoft Scripting Runtime" and click "OK" to save. This gives the program access to the Windows API for file handling.
- 2). Declare two variables: one as a "FileSystemObject" and the other as a "TextStream":
Dim oFSO as New Scripting.FileSystemObject
Dim oMyFile as Scripting.TextStream
Next, open the file for reading into the TextStream.
Set oMyFile = oFSO.OpenTextFile(FileName, ForReading)
Also declare a variable to hold each line of the TextStream as "Dim sLineRead as String." - 3). Process the text file line by line within a loop written as "While Not oMyFile.AtEndOfStream." Set "sLineRead" equal to one line of text from the TextStream:
sLineRead = oMyFile.ReadLine
If there are any accents contained in "sLineRead" you can replace them with another value using VB's "replace" method. - 4). Identify the accent character to be removed. For example, text containing "è" can be replaced with "e" prior to displaying or inserting the data into a database:
sLineRead = Replace(sLineRead, "è","e")
This line of code replaces all instances of "è" with "e" within the line of text read into "sLineRead" without changing any of the original data.
Source...