Special Characters im memo field causes error

G

Guest

I have a memo field for users to add text into and then I create a file using
TextStream and Writeline. Some of my users are copying and pasting
information from Word which works fine when there are no special characters
or symbols, even bullets seem to come over ok. However when there is a
special character I get an error code 5 invalid procedure or call when I try
to write the field out to a file.

Is there a way to check the memo field for only valid characters before I
write it out in order to prevent the error?

Thanks in advance for any help!

Jerr
 
J

John Nurick

Hi Jerr,

I'd probably use my rgxReplace() function (at
http://www.j.nurick.dial.pipex.com/Code/vbRegex/rgxReplace.htm ) to
replace the characters in question with something innocuous.

Just what's the best strategy depends on what they are and whether the
text is ANSI or Unicode. One approach is to use a character class that
excludes all characters that might cause a problem, e.g.
rgxReplace(strMemoText, "[^\x0a\x0d\x20-\xff]", "")
will delete all control characters except for CR (hex 0d) and LF (hex
0a).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top