OUTLOOK 2003 VBA Mails kopieren auf Festplatte
Hallo alle zusammen,
ich will mit Outlook VBA alle Mails im Ordner "test.pst" aus dem Ordner "Eingang" auf die Festplatte D:\archive mit dem Datum´, Uhrzeit und dem Betreff als Dateiname speichern. Ich krieg es einfach nicht hin.
Dim objOutlook
Dim objnSpace
Dim objFolder
Dim objmail
Dim objNewMail As MailItem
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.Folders("Kerstin").Folders("merken")
For Each objNewMail In objFolder.Items
With objNewMail
.Copy ????????
End With
Next
Einen schönen Gruß
Ralf Dorn
ich will mit Outlook VBA alle Mails im Ordner "test.pst" aus dem Ordner "Eingang" auf die Festplatte D:\archive mit dem Datum´, Uhrzeit und dem Betreff als Dateiname speichern. Ich krieg es einfach nicht hin.
Dim objOutlook
Dim objnSpace
Dim objFolder
Dim objmail
Dim objNewMail As MailItem
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.Folders("Kerstin").Folders("merken")
For Each objNewMail In objFolder.Items
With objNewMail
.Copy ????????
End With
Next
Einen schönen Gruß
Ralf Dorn
Please also mark the comments that contributed to the solution of the article
Content-Key: 92630
Url: https://administrator.de/contentid/92630
Printed on: April 20, 2024 at 02:04 o'clock
8 Comments
Latest comment
Moin
Als erstes würde ich dir zum Entwickelm empfehlen einen Verweis auf die Microsoft Outlook Object Library zu setzen.
Dann könntest du das so machen: (Ungetestet!!)
Gruß L.
Als erstes würde ich dir zum Entwickelm empfehlen einen Verweis auf die Microsoft Outlook Object Library zu setzen.
Dann könntest du das so machen: (Ungetestet!!)
Dim objOutlook As Outlook.Application
Dim objnSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objNewMail As Outlook.MailItem
Dim Filename as String
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.Folders("Kerstin").Folders("merken")
For Each objNewMail In objFolder.Items
With objNewMail
Filename = CStr(.SendOn) & " " & CStr(.Subject) & ".msg"
.SaveAs ("C:\MeinPfad\" & Filename )
End With
Next
Gruß L.
Probiers mal so:
Evtl. hilft dier dieser Link weiter.
Gruß L.
...
.SaveAs "D:\outlook\" & Filename, olMSG
...
Außerdem kommt die lästige Frage mit "Ein Programm versucht auf Daten von Outlook zuzugreifen....."
Nun das ist ja auch richtig.Evtl. hilft dier dieser Link weiter.
Gruß L.