0
전자 메일에있는 Excel (.xlsm) 파일을 저장하려고합니다. 다른 이메일을 통해이 이메일을받습니다.전자 메일 첨부 파일 첨부 저장 중
.xlsm 파일을 공유 드라이브에 다운로드하고 싶습니다. 여러 온라인 포럼과 MSDN 도움말을 보면 다음 코드를 작성했습니다.
이 코드를 실행할 때 오류가 발생하지 않습니다. 또한 어떤 파일도 저장되지 않습니다.
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim msgAtt As Outlook.Attachment
Dim saveFolder As String
' a to i are dummy names and have been replaced with correct folder path in real code
saveFolder = "\\a\b\c\d\e\f\g\h\i"
For Each objAtt In itm.Attachments
If InStr(objAtt.DisplayName, ".msg") Then
For Each msgAtt In itm.Attachments
If InStr(msgAtt.DisplayName, ".xlsm") Then
msgAtt.SaveAsFile saveFolder & "\" & msgAtt.DisplayName
End If
Next
Set msgAtt = Nothing
End If
Next
Set objAtt = Nothing
End Sub
가능한 복제 (https://stackoverflow.com/questions/7890612/vba [첨부 파일을 저장하는 VBA 코드는 첨부 파일로 다른 이메일 안에이었던 Outlook 전자 메일에서 (엑셀 파일)] -code-to-save-an-attachment-excel-out-of-outlook-email-inside-inside-file) – niton
@niton 원하는 결과가 동일하지만이 경우 직면 한 특정 문제는 그 사건과 다른 –