发送前保存当前附件的副本
Save a copy of the current attachment before sending
如何在发送之前保存刚刚附加的附件的副本作为备份。
任何帮助都会很棒!谢谢。
Dim outlookOBJ As Object
Dim MItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set MItem = outlookOBJ.CreateItem(olMailItem)
With MItem
.To = "email1@gmail.com"
'.cc = "email2@gmail.com"
.Subject = " Test Subject"
.body = " test text in body of email" & Me.EvalID_T1.Value
.Attachments.Add (ActiveWorkbook.Worksheets("BrowseFile").Cells(4,3).Value)
'want to add some kind of save current attachment feature here right before I send
.send
只需使用For Each … In … Next Loop
即可保存当前MItem.Attachments
With MItem
.To = "email1@gmail.com"
'.cc = "email2@gmail.com"
.Subject = " Test Subject"
.Body = " test text in body of email" & Me.EvalID_T1.value
.Attachments.Add (ActiveWorkbook.Worksheets("BrowseFile").Cells(4, 3).value)
Dim Atmt As Object
For Each Atmt In MItem.Attachments
Debug.Print Atmt.DisplayName
Atmt.SaveAsFile "C:\Temp\" & Atmt.DisplayName
Next
.Display
End With
如何在发送之前保存刚刚附加的附件的副本作为备份。
任何帮助都会很棒!谢谢。
Dim outlookOBJ As Object
Dim MItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set MItem = outlookOBJ.CreateItem(olMailItem)
With MItem
.To = "email1@gmail.com"
'.cc = "email2@gmail.com"
.Subject = " Test Subject"
.body = " test text in body of email" & Me.EvalID_T1.Value
.Attachments.Add (ActiveWorkbook.Worksheets("BrowseFile").Cells(4,3).Value)
'want to add some kind of save current attachment feature here right before I send
.send
只需使用For Each … In … Next Loop
即可保存当前MItem.Attachments
With MItem
.To = "email1@gmail.com"
'.cc = "email2@gmail.com"
.Subject = " Test Subject"
.Body = " test text in body of email" & Me.EvalID_T1.value
.Attachments.Add (ActiveWorkbook.Worksheets("BrowseFile").Cells(4, 3).value)
Dim Atmt As Object
For Each Atmt In MItem.Attachments
Debug.Print Atmt.DisplayName
Atmt.SaveAsFile "C:\Temp\" & Atmt.DisplayName
Next
.Display
End With