Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim sName As String
Dim sPath As String
Dim enviro As String
On Error Resume Next
enviro = CStr(Environ("username"))
Const olmsg = 3
ReplaceCharsForFileName sName, "_"
sPath = enviro & "C:\Users\username\Desktop\Sent emails\"
sName = Item.Subject & ".msg"
Debug.Print sPath & sName
Item.SaveAs sPath & sName, olmsg
End Sub
Private Sub ReplaceCharsForFileName(fName As String, _
sChr As String _
)
sName = Replace(sName, "/", sChr)
sName = Replace(sName, "\", sChr)
sName = Replace(sName, ":", sChr)
sName = Replace(sName, "?", sChr)
sName = Replace(sName, Chr(34), sChr)
sName = Replace(sName, "<", sChr)
sName = Replace(sName, ">", sChr)
sName = Replace(sName, "|", sChr)
sName = Replace(sName, "#", sChr)
sName = Replace(sName, ",", sChr)
sName = Replace(sName, "||", sChr)
End Sub
Please help this code works fine only if I do not have RE: in the subject line....I am not sure where I am making a mistake...this code could also be wrong or you may find some unnecessary lines in this...Please help...