Theva
asked on
Save email copy
Hi Experts,
I need Experts help to troubleshoot the attached script. The script by right should be able to save the sent email into separate network folder. But, for some reason this can’t be achieved. I hope Experts can help me to rectify this problem. Attached is the mentioned script.
I need Experts help to troubleshoot the attached script. The script by right should be able to save the sent email into separate network folder. But, for some reason this can’t be achieved. I hope Experts can help me to rectify this problem. Attached is the mentioned script.
Dim WithEvents olkFolder As Outlook.Items
Private Sub Application_Quit()
Set olkFolder = Nothing
End Sub
Private Sub Application_Startup()
Set olkFolder = Session.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub olkFolder_ItemAdd(ByVal Item As Object)
'Edit the condition on the next line'
If Left(Item.Subject, 12) = "TK Followup:" Then
'Edit the folder path on the next line'
Item.SaveAs "\\bc02\email\Report\" & Item.Subject & ".msg", olMSG
End If
End Sub
ALso I presume you have restarted outlook since the code was inserted?
CHris
CHris
ASKER
Hi Chris,
I've crosscheck the subject's title, also restarted the outlook but nothing happen.
I've crosscheck the subject's title, also restarted the outlook but nothing happen.
Is the code located in thisOutlookSession?
ASKER
Hi Chris,
The creator of this code has responded with the revised version (attached) and its work. However, this is only save email which has “TK Followup:”. If the user using the same email for reply, then its loosing the save function. Is that anyway for us to save the email with reply version if the subject has this title “TK Followup:”? Hope you can assist.
The creator of this code has responded with the revised version (attached) and its work. However, this is only save email which has “TK Followup:”. If the user using the same email for reply, then its loosing the save function. Is that anyway for us to save the email with reply version if the subject has this title “TK Followup:”? Hope you can assist.
Dim WithEvents olkFolder As Outlook.Items
Private Sub Application_Quit()
Set olkFolder = Nothing
End Sub
Private Sub Application_Startup()
Set olkFolder = Session.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub olkFolder_ItemAdd(ByVal Item As Object)
'Edit the condition on the next line'
If Left(Item.Subject, 12) = "TK Followup:" Then
'Edit the folder path on the next line'
Item.SaveAs "\\So02\report\mail\" & RemoveIllegalCharacters(Item.Subject) & ".msg", olMSG
End If
End Sub
Function RemoveIllegalCharacters(strValue As String) As String
' Purpose: Remove characters that cannot be in a filename from a string.'
RemoveIllegalCharacters = strValue
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "<", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, ">", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, ":", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, Chr(34), "'")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "/", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "\", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "|", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "?", "")
RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "*", "")
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Chris,
Thanks for the great help. Before I close this Q, I need your advice how to handle email that were saved in network folder. Sometime we could discuss about one issue with many reply emails (ping pong). Is that anyway for to us automatically grouped the email if we have similar subject matter. If there is, then I will get Experts help.
Thanks for the great help. Before I close this Q, I need your advice how to handle email that were saved in network folder. Sometime we could discuss about one issue with many reply emails (ping pong). Is that anyway for to us automatically grouped the email if we have similar subject matter. If there is, then I will get Experts help.
Within my knowledge, it depends on mail clients used, if for example someone in the chain uses (for example) Giggle MAil then no. If everyone is using outlook, then yes I think so.
Chris
Chris
ASKER
Hi Chris,
My team using Outlook. How to put this in question so that Experts know what am looking for. Sorry, I have no clue how to address this.
My team using Outlook. How to put this in question so that Experts know what am looking for. Sorry, I have no clue how to address this.
It may be easy!
In teh code you are using try replacing all references to Item.Subject with Item.conversationtopic
Chris
In teh code you are using try replacing all references to Item.Subject with Item.conversationtopic
Chris
ASKER
Hi,
Have changed, but nothing was copied in the network folder. Attached the modified code for your perusal.
Have changed, but nothing was copied in the network folder. Attached the modified code for your perusal.
Private Sub olkFolder_ItemAdd(ByVal Item As Object)
'Edit the condition on the next line'
If Left(Item.ConversationTopic, 12) = "TK Followup:" Or Mid(Item.Subject, 5, 12) = "TK Followup:" Then
'Edit the folder path on the next line'
Item.SaveAs "\\bc04\email\Report\" & RemoveIllegalCharacters(Item.ConversationTopic) & ".msg", olMSG
End If
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Chris,
Thanks a lot for helping me to create this feature.
Thanks a lot for helping me to create this feature.
Chris