Alan McGowan
Senior Member
- Outlook version
- Outlook 2013 64 bit
- Email Account
- Exchange Server
HI, I'm using the code below to remove illegal characters before saving an email in MSG format. At present the illegal characters are either replaced with a hyphen or an underscore. I would like to amend this to simply remove the illegal characters and not substitute e.g. hel&p would become help rather than hel-p. However when I replace "_" in the code below with "" I get an error?
Code:
' Clean out characters from Subject which are not permitted in a file name
For intC = 1 To Len(strMsgSubj)
If InStr(1, ":<&>""", Mid(strMsgSubj, intC, 1)) > 0 Then
Mid(strMsgSubj, intC, 1) = "-"
End If
Next intC
For intC = 1 To Len(strMsgSubj)
If InStr(1, "\/|*?", Mid(strMsgSubj, intC, 1)) > 0 Then
Mid(strMsgSubj, intC, 1) = "_"
End If
Next intC