Hi,
Could someone help me to understanding why the code bolow do not backups reply or forward emails? i works on received or send emails only...
Thanks in advance!
Could someone help me to understanding why the code bolow do not backups reply or forward emails? i works on received or send emails only...
Code:
Sub backup_selectioProject()
Dim OL As Application
Dim NmeSpace As NameSpace
Dim FNme As String
Dim dtDate As Date
'Dim omail As Outlook.MailItem
Set OL = CreateObject("Outlook.Application")
Set NmeSpace = OL.GetNamespace("MAPI")
Set Inbx = NmeSpace.GetDefaultFolder(olFolderInbox)
Set Fldr = Application.ActiveExplorer.CurrentFolder
DirName = "Z:\Departments-WUIB\"
For Each itm In ActiveExplorer.Selection
SubTxt = itm.Subject
'SubTxt = CleanString(SubTxt) 'removes characters that cannot be part of filename
dtDate = itm.ReceivedTime
'Set omail = objItem
'dtDate = omail.ReceivedTime
FNme = DirName & SubTxt & "_" & Format(dtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
vbUseSystem) & ".MSG"
'sName = Format(dtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
vbUseSystem) & Format(dtDate, "-hhnnss", _
vbUseSystemDayOfWeek, vbUseSystem) & "-" & sName & ".msg"
'sPath = enviro & "\Documents\"
If itm.Class = olMail Then
itm.SaveAs FNme, olMSG
End If
Next
End Sub
Thanks in advance!
Last edited by a moderator: