Jamie,
this is my trim function. Just add space in the list (you should not be able
to have tabs within a string, just spaces). It should do the job. It also
takes in a parameter if you want to cut the string after a certain number of
characters (charts having more than 32 characters in the name of it start to
behave oddly, that's why I have it).
HTH,
Jouni
Finland
Function TrimString(strString As String, intLength As Integer) As String
' removes illegal characters for worksheets and charts.
' sets length as passed.
Dim intChar As Integer
For intChar = 1 To Len(strString)
If Mid(strString, intChar, 1) <> "/" And Mid(strString, intChar, 1)
<> "\" And _
Mid(strString, intChar, 1) <> "*" And Mid(strString, intChar, 1)
<> "?" And _
Mid(strString, intChar, 1) <> ":" And Mid(strString, intChar, 1)
<> " " And _
Mid(strString, intChar, 1) <> "," And Mid(strString, intChar, 1)
<> "." And _
Mid(strString, intChar, 1) <> "(" And Mid(strString, intChar, 1)
<> ")" And _
Mid(strString, intChar, 1) <> "[" And Mid(strString, intChar, 1)
<> "]" And _
Mid(strString, intChar, 1) <> "-" And Mid(strString, intChar, 1)
<> "&" And _
Mid(strString, intChar, 1) <> "'" And Mid(strString, intChar, 1)
<> ";" And _
Mid(strString, intChar, 1) <> "_" And Mid(strString, intChar, 1)
<> "anything_crap" Then
TrimString = TrimString & Mid(strString, intChar, 1)
End If
Next
TrimString = Left(TrimString, intLength)
End Function