전자 메일 주소에 따라 전자 메일 첨부 파일을 폴더에 저장하는 VBA 매크로를 만들려고합니다. 예를 들어 [email protected]에서 첨부 파일을 받고 이메일로 첨부 파일 인 \ server \ home \ joey 에 저장하려고하거나 [email protected]에서받은 경우 첨부 파일을 저장해야합니다. \ server \ home \ steve.첨부 파일을 네트워크 위치에 저장
마지막으로 저장 한 파일의 이름이 포함 된 답장 전자 메일을 보내려고합니다. 거의 원하는 코드를 찾았지만 수정하기가 힘듭니다. 이것은 모두 Outlook 2010에서 수행되고 있습니다. 이것은 내가 지금까지 가지고있는 것입니다. 어떤 도움이라도 대단히 감사하겠습니다.
Const mypath = "\\server\Home\joe\"
Sub save_to_v()
Dim objItem As Outlook.MailItem
Dim strPrompt As String, strname As String
Dim sreplace As String, mychar As Variant, strdate As String
Set objItem = Outlook.ActiveExplorer.Selection.item(1)
If objItem.Class = olMail Then
If objItem.Subject <> vbNullString Then
strname = objItem.Subject
Else
strname = "No_Subject"
End If
strdate = objItem.ReceivedTime
sreplace = "_"
For Each mychar In Array("/", "\", ":", "?", Chr(34), "<", ">", "|")
strname = Replace(strname, mychar, sreplace)
strdate = Replace(strdate, mychar, sreplace)
Next mychar
strPrompt = "Are you sure you want to save the item?"
If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then
objItem.SaveAs mypath & strname & "--" & strdate & ".msg", olMSG
Else
MsgBox "You chose not to save."
End If
End If
End Sub
귀하의 도움에 감사드립니다. –