Hello,
I have the following code that saves a message to our server with the Date/Time and Subject of the email then sends:
Sub SaveAs828()
Dim myItem As Outlook.Inspector
Dim objItem As Object
Dim EmailDate As Date
Dim MyMail As MailItem
Dim MailDate As String
On Error Resume Next
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector
Set MyMail = myItem.CurrentItem
If Not TypeName(myItem) = "Nothing" Then
Set objItem = myItem.CurrentItem
MailDate = Now()
MailDate = Replace(MailDate, "/", "-")
MailDate = Replace(MailDate, ":", ".")
strname = objItem.Subject
If strname <> vbNullString Then
objItem.SaveAs "C:\FILEPATH\" & MailDate & strname & ".msg", olMSG
Else
MsgBox "Please enter valid file name"
End If
End If
objItem.Send
End Sub
It works fine, but not when I attach files to the email. When I add attachments, it still sends, but does not save to the computer. It did before I added the Date and Time to the Document name. Help?
Thanks
I have the following code that saves a message to our server with the Date/Time and Subject of the email then sends:
Sub SaveAs828()
Dim myItem As Outlook.Inspector
Dim objItem As Object
Dim EmailDate As Date
Dim MyMail As MailItem
Dim MailDate As String
On Error Resume Next
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector
Set MyMail = myItem.CurrentItem
If Not TypeName(myItem) = "Nothing" Then
Set objItem = myItem.CurrentItem
MailDate = Now()
MailDate = Replace(MailDate, "/", "-")
MailDate = Replace(MailDate, ":", ".")
strname = objItem.Subject
If strname <> vbNullString Then
objItem.SaveAs "C:\FILEPATH\" & MailDate & strname & ".msg", olMSG
Else
MsgBox "Please enter valid file name"
End If
End If
objItem.Send
End Sub
It works fine, but not when I attach files to the email. When I add attachments, it still sends, but does not save to the computer. It did before I added the Date and Time to the Document name. Help?
Thanks