Direkt zum Inhalt

Wie exportiere ich Outlook-E-Mail-Text in eine Excel-Tabelle?

Wenn Sie den ausgewählten E-Mail-Text von Outlook in eine Excel-Tabelle exportieren möchten, kann Ihnen die Methode in diesem Artikel helfen.

Exportieren Sie den Outlook-E-Mail-Text in eine Excel-Tabelle mit VBA-Code


Exportieren Sie den Outlook-E-Mail-Text in eine Excel-Tabelle mit VBA-Code<

Führen Sie den folgenden VBA-Code aus, um den ausgewählten Text einer Outlook-E-Mail nach Excel zu exportieren.

1. Öffnen Sie die E-Mail, wählen Sie den E-Mail-Text aus, den Sie in eine Excel-Tabelle exportieren möchten, und drücken Sie dann die Taste Andere + F11 Schlüssel zum Öffnen der Microsoft Visual Basic für Applikationen Fenster.

2. In dem Microsoft Visual Basic für Applikationen Klicken Sie im Fenster Insert > Modul. Und dann kopieren Sie den folgenden VBA-Code in das Code-Fenster.

VBA-Code: Exportieren Sie den Outlook-E-Mail-Text in eine Excel-Tabelle

Sub ExportToExcel()
Dim xExcel As Excel.Application
Dim xWb As Workbook
Dim xWs As Worksheet
Dim xInspector As Inspector
Dim xItem As Object
Dim xMailItem As MailItem
Dim xDoc As Document
Dim xShell As Object
Dim xFilePath As String
On Error Resume Next
    Set xShell = CreateObject("Shell.Application")
    Set xFolder = xShell.BrowseForFolder(0, "Select a Folder:", 0, 0)
    If TypeName(xFolder) = "Nothing" Then Exit Sub
    Set xFolderItem = xFolder.Self
    xFilePath = xFolderItem.Path & "\"
    Set xItem = Outlook.Application.ActiveExplorer.Selection.item(1)
    If xItem.Class <> olMail Then Exit Sub
    Set xMailItem = xItem
    Set xInspector = xMailItem.GetInspector
    Set xDoc = xInspector.WordEditor
    xDoc.Application.Selection.Range.Copy
    xInspector.Close olDiscard
    Set xExcel = New Excel.Application
    Set xWb = xExcel.Workbooks.Add
    Set xWs = xWb.Sheets.item(1)
    xExcel.Visible = False
    xWs.Activate
    xWs.Paste
    xWs.SaveAs xFilePath & "Email body.xlsx"
    xWb.Close True
    xExcel.Quit
    Set xWs = Nothing
    Set xWb = Nothing
    Set xExcel = Nothing
End Sub

Note: Im Code “E-Mail body.xlsx”Ist der Name der Arbeitsmappe, die Sie mit dem ausgewählten E-Mail-Text erstellen. Sie können es nach Bedarf ändern.

3 Klicken Tools > Bibliographie. Dann überprüfen Sie beide Microsoft Excel-Objektbibliothek und Microsoft Word-Objektbibliothek Boxen in der Referenzen - Projekt Dialogbox. Siehe Screenshot:

4. Dann a Suche nach Ordner Das Dialogfeld wird angezeigt. Wählen Sie einen Ordner zum Speichern der Arbeitsmappe aus und klicken Sie auf OK .

Jetzt eine Arbeitsmappe mit dem Namen „E-Mail-Körper”Wird erstellt und in einem bestimmten Ordner gespeichert. Öffnen Sie die Arbeitsmappe. Sie können sehen, dass der ausgewählte E-Mail-Text in Blatt 1 der Arbeitsmappe exportiert wird.


Beste Office-Produktivitätstools

Kutools for Outlook - Über 100 leistungsstarke Funktionen zur Optimierung Ihres Outlooks

🤖 KI-Mail-Assistent: Sofortige Profi-E-Mails mit KI-Magie – geniale Antworten mit einem Klick, perfekter Ton, mehrsprachige Beherrschung. Verwandeln Sie den E-Mail-Versand mühelos! ...

📧 E-Mail Automation: Abwesenheit (verfügbar für POP und IMAP)  /  Planen Sie das Senden von E-Mails  /  Automatisches CC/BCC nach Regeln beim E-Mail-Versand  /  Automatische Weiterleitung (erweiterte Regeln)   /  Begrüßung automatisch hinzufügen   /  Teilen Sie E-Mails mit mehreren Empfängern automatisch in einzelne Nachrichten auf ...

📨 E-Mail-Management: E-Mails einfach abrufen  /  Blockieren Sie betrügerische E-Mails nach Betreff und anderen  /  Doppelte E-Mails löschen  /  Erweiterte Suche  /  Ordner konsolidieren ...

📁 Anhänge ProBatch speichern  /  Stapeltrennung  /  Stapelkomprimierung  /  Automatisches Speichern   /  Automatische Trennung  /  Automatische Komprimierung ...

???? Schnittstellenmagie: 😊Mehr hübsche und coole Emojis   /  Steigern Sie Ihre Outlook-Produktivität mit Registerkartenansichten  /  Ausblick minimieren statt schließen ...

👍 Wunder mit einem Klick: Allen mit eingehenden Anhängen antworten  /   Anti-Phishing-E-Mails  /  🕘Zeitzone des Absenders anzeigen ...

👩🏼‍🤝‍👩🏻 Kontakte und Kalender: Fügen Sie Kontakte aus ausgewählten E-Mails im Stapel hinzu  /  Teilen Sie eine Kontaktgruppe in einzelne Gruppen auf  /  Geburtstagserinnerungen entfernen ...

Auf über 100 Eigenschaften Warten Sie auf Ihre Erkundung! Klicken Sie hier, um mehr zu erfahren.

 

 

Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
this work but in one email only what if in folder theres a multiple email thats need to be extracted in excel?
This comment was minimized by the moderator on the site
Você vai precisar implementar o código fazendo um Looping, com um FOR por exemplo:

Sub lerEmails()

' Criando a aplicação do Outlook
Dim objOutlook As Object
Set objOutlook = CreateObject("Outlook.Application")

' Criando um Namespace, que seria uma sessão no Outlook
Dim objNSpace As Object
Set objNSpace = objOutlook.GetNamespace("MAPI")

' Cria um objeto com a pasta Inbox do Outlook
Dim minhaPasta As Object
Set minhaPasta = objNSpace.GetDefaultFolder(olFolderInbox)

Dim i As Long
Dim itemPasta As Object

i = 2 'Linha que vai começar preenchendo na planilha

' Percorrer todos os itens dentro da pasta
For Each itemPasta In minhaPasta.Items

If itemPasta.Class = olMail Then
Dim objEmail As Outlook.MailItem
Set objEmail = itemPasta

Cells(i, 1).Value = objEmail.SenderEmailAddress
Cells(i, 2).Value = objEmail.To
Cells(i, 3).Value = objEmail.Subject
Cells(i, 4).Value = objEmail.ReceivedTime
Cells(i, 5).Value = objEmail.Body
Cells(i, 5).WrapText = False

End If
i = i + 1

Next

Set objEmail = Nothing
Set objOutlook = Nothing
Set objNSpace = Nothing
Set minhaPasta = Nothing

End Sub
This comment was minimized by the moderator on the site
Hi the code only returned directly, into the excel and not the body of the email, may I know why was that??
This comment was minimized by the moderator on the site
same issue for me as well
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations