Ga naar hoofdinhoud

Hoe automatisch Outlook-e-mails op de harde schijf / schijf opslaan?

Voor back-up, werkbewijs of andere doeleinden wilt u misschien Outlook-e-mails op de harde schijf opslaan. Het is gemakkelijk om meerdere e-mails op schijf op te slaan door ze handmatig van Outlook naar schijf te slepen. Weet u echter hoe u elke inkomende e-mail automatisch op schijf kunt opslaan? Dit artikel introduceert een VBA om deze in Outlook af te handelen.

Sla automatisch Outlook-e-mails op de harde schijf / schijf op


Sla automatisch Outlook-e-mails op de harde schijf / schijf op

Deze methode introduceert een VBA om automatisch elke inkomende e-mail in Outlook op te slaan als individueel HTML-bestand op de specifieke schijf. Ga als volgt te werk:

1. pers anders + F11 -toetsen om het venster Microsoft Visual Basic for Applications te openen.

2. Vouw Project1 uit en dubbelklik DezeOutlookSessie om het te openen en plak vervolgens onder VBA-code in het ThisOutlookSession-venster. Zie screenshot:

VBA: automatisch Outlook-e-mails opslaan als HTML-bestanden op schijf

Private WithEvents InboxItems As Outlook.Items
Sub Application_Startup()
Dim xNameSpace As Outlook.NameSpace
Set xNameSpace = Outlook.Application.Session
Set InboxItems = xNameSpace.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub InboxItems_ItemAdd(ByVal objItem As Object)
Dim FSO
Dim xMailItem As Outlook.MailItem
Dim xFilePath As String
Dim xRegEx
Dim xFileName As String
On Error Resume Next
xFilePath = CreateObject("WScript.Shell").SpecialFolders(16)
xFilePath = xFilePath & "\MyEmails"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(xFilePath) = False Then
FSO.CreateFolder (xFilePath)
End If
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
If objItem.Class = olMail Then
Set xMailItem = objItem
xFileName = xRegEx.Replace(xMailItem.Subject, "")
xMailItem.SaveAs xFilePath & "\" & xFileName & ".html", olHTML
End If
Exit Sub
End Sub

3. Sla de VBA-code op en start uw Microsoft Outlook opnieuw.

Vanaf nu wordt elke inkomende e-mail opgeslagen als een afzonderlijk HTML-bestand in de map "Mijn e-mails".

Opmerkingen:
(1) Deze VBA maakt een map met de naam "Mijn e-mails" onder de map Documenten. U kunt de automatisch opgeslagen e-mails vinden met dit mappad: C:\Gebruikers\uw_gebruikersnaam\Documenten\MijnE-mails
(2) Deze VBA werkt met e-mails die worden ontvangen in de map Inbox van het standaard e-mailaccount.


Gerelateerde artikelen


Beste Office-productiviteitstools

Kutools for Outlook - Meer dan 100 krachtige functies om uw Outlook een boost te geven

🤖 AI Mail-assistent: Directe professionele e-mails met AI-magie: met één klik geniale antwoorden, perfecte toon, meertalige beheersing. Transformeer e-mailen moeiteloos! ...

???? Email Automation: Niet aanwezig (beschikbaar voor POP en IMAP)  /  Plan het verzenden van e-mails  /  Automatische CC/BCC volgens regels bij het verzenden van e-mail  /  Automatisch doorsturen (geavanceerde regels)   /  Begroeting automatisch toevoegen   /  Splits e-mails van meerdere ontvangers automatisch op in individuele berichten ...

📨 email management: Gemakkelijk e-mails herinneren  /  Blokkeer zwendel-e-mails van onderwerpen en anderen  /  Verwijder dubbele e-mails  /  Uitgebreid Zoeken  /  Consolideer mappen ...

📁 Bijlagen ProBatch opslaan  /  Batch losmaken  /  Batchcompressie  /  Automatisch opslaan   /  Automatisch loskoppelen  /  Automatisch comprimeren ...

???? Interface-magie: 😊Meer mooie en coole emoji's   /  Verhoog uw Outlook-productiviteit met weergaven met tabbladen  /  Minimaliseer Outlook in plaats van te sluiten ...

???? Wonderen met één klik: Beantwoord iedereen met inkomende bijlagen  /   Antiphishing-e-mails  /  🕘Toon de tijdzone van de afzender ...

👩🏼‍🤝‍👩🏻 Contacten en agenda: Batchcontacten toevoegen uit geselecteerde e-mails  /  Splits een contactgroep in individuele groepen  /  Verwijder verjaardagsherinneringen ...

Over 100 Eigenschappen Wacht op je verkenning! Klik hier om meer te ontdekken.

 

 

Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I need to change the folder for one i created (no need folder inbox), and i need to change the folder to store the msg files, in my case in drive e:., thank!!!
This comment was minimized by the moderator on the site
Can i have a certain report that is emailed to me each week save to a place on my hard drive? Just this one email. Comes from same email address and has the same title each week.
This comment was minimized by the moderator on the site
Could you advise how to change this to another folder, not the Inbox?
This comment was minimized by the moderator on the site
Dzień doby, robię wszystko tak jak opisane powyżej, mimo to makro nie chce działać. Czy muszę włączyć jakieś opcję albo zmienić coś w kodzie?
Nie wywala błędu jednak nie tworzy się folder a plik się nie zapisuje.

Będę bardzo wdzięczna za odpowiedź

Pozdrawiam serdecznie
This comment was minimized by the moderator on the site
How can I add the sender's email address to the file name?
This comment was minimized by the moderator on the site
Buonasera, è possibile modificare questo script con una versione che prevede di spostare i messaggi che arrivano in altra cartella anzichè quella classica della posta in arrivo? In altri termini, vorrei salvare automaticamente le mail che arrivano per esempio in Posta in Arrivo\Cliente1
grazie per la collaborazione
max
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations