Try the Replace function to replace them with "".
Public Function ReplaceCharacters(ByVal strIn As String) As String
Dim strCheck As String, i As Integer
strCheck = "\/:*?""<>|"
For i = 1 To Len(strCheck)
strIn = Replace(strIn, Mid$(strCheck, i, 1), "")
Next i
ReplaceCharacters = strIn
End Function
The two double quotes are needed in the middle of strCheck. If you only use
a single double quote here, VBA will think that it has reached the end of
the string. Doubling up the quotes tells VBA to place a quote in the string.
The "first" character is not a capital V, it is a back slash and forward
slash (2 characters).
--
Wayne Morgan
Microsoft Access MVP
The Skydiver said:
How can one remove the following characters out of a VBA string so It
can
be
used for naming a file:
\ / : * ? " < > |
Thank you
-=[JAV]=-