Der folgende Code speichert die Anhänge [im Ordner "Eigene Dateien"] von "ausgewählten" E-Mails in Outlook.Wie ändere ich den Pfad von "specialfolders (16)" in einen XYZ-Ordner auf C-Laufwerk?
Können Sie bitte beraten, wie Sie den Speicherort des sFolderPath = objWSCript.specialfolders(16)
in einen Ordner "New Folder" auf C-Laufwerk ändern?
Option Explicit
Sub SaveAttchFiles()
Dim olMail As MailItem
Dim olAtchs As Attachments
Dim olSelection As Selection
Dim iCount As Long, i As Long
Dim sFolderPath As String, sFilePath As String, sDeletedFiles As String
Dim objWSCript As Object
On Error Resume Next
Set objWSCript = CreateObject("WSCript.Shell")
sFolderPath = objWSCript.specialfolders(16)
Set olSelection = ActiveExplorer.Selection
sFolderPath = sFolderPath & "\New Folder\"
For Each olMail In olSelection
Set olAtchs = olMail.Attachments
iCount = olAtchs.Count
sDeletedFiles = ""
If iCount > 0 Then
For i = iCount To 1 Step -1
sFilePath = sFolderPath & olAtchs.Item(i).FileName
olAtchs.Item(i).SaveAsFile sFilePath
Next i
End If
Next olMail
Door:
Set objWSCript = Nothing
Set olAtchs = Nothing
Set olSelection = Nothing
End Sub
'sFolderPath = "C: \ myfolder \"' – ACatInLove
..als in, Sie wollen ** ** erstellen Sie einen neuen Ordner oder der Ordner ** genannt ** "Neuer Ordner"? – ashleedawg
oder möchten Sie einen Ordner aus einem Dialogfeld auswählen? –