Importieren von E-Mails von Outlook 2013 zu Excel 2013 funktioniert mit Home Desktop. Outlook 2013 ist mit dem SMTP/POP-Server verbunden.Importieren von E-Mails von Outlook 2013 mit Exchange-Server mit Excel VBA
Derselbe Code funktioniert nicht in meinem Büro. Outlook 2013 ist mit dem Exchange-Server verbunden.
Fehler bei .Senderemailaddress
Option Explicit
Dim n As Long
Sub Get_data()
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olFolder As Outlook.MAPIFolder
Dim Date1, Date2
Date1 = "01/26/2017"
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.PickFolder
n = 2
Call Get_Emails(olFolder, Date1)
Set olNS = Nothing
Set olFolder = Nothing
Set olApp = Nothing
Set olNS = Nothing
End Sub
Sub Get_Emails(olfdStart As Outlook.MAPIFolder, Date1)
Dim olFolder As Outlook.MAPIFolder
Dim olObject As Object
Dim olMail As Outlook.MailItem
Dim Recivedt As Date
For Each olObject In olfdStart.Items
If TypeName(olObject) = "MailItem" Then
If olObject.ReceivedTime <= Date1 Then
n = n + 1
Set olMail = olObject
'Sno
Cells(n, 1) = n
'Universal id
Cells(n, 2) = olMail.ConversationID
'Email id
'Getting debug error here as not supported.
Cells(n, 3) = olMail.SenderEmailAddress '**
'Date and time workings
Cells(n, 4) = olMail.ReceivedTime
'Size
Cells(n, 6) = olMail.Size
'Subject
Cells(n, 7) = olMail.Subject
End If
End If
Next
Set olMail = Nothing
Set olFolder = Nothing
Set olObject = Nothing
End Sub
Und was ist mit Ihrem Code ist der entsprechende Code-Schnipsel? Welche Zeile löst die Ausnahme aus? Was ist die ** genaue ** Ausnahme? –
@DmitryStreblechenko es ist mit VBA getaggt, so würde es nicht eine * Ausnahme * (das wäre eine. Net-Sache), aber ein "Laufzeitfehler" sein. Aber ja, ich stimme Ihnen definitiv zu - mit dieser Frage ist nichts ohne Code und zusätzliche Informationen zu machen. –
Die Ausnahmen wären Standard-COM-Ausnahmen - OOM weiß nicht, ob es von VBA verwendet wird. Net, Delphi oder C++. Ausnahmen sind definitiv nicht .Net-spezifisch. VBA (die auf COM basiert) hat nur eine lustige Art der Handhabung von ihnen mit "auf Fehler ..." usw. –