unten aufgeführt, habe ich von Hans eine sehr schöne Prozedur mit der man Emails aus Outlook nach Excel importieren kann.
Mein Problem ist, das ich die Prozedur gerne ändern würde, habe aber leider nicht genügend Kenntnis um dies zu tun.
Die Zeile, wo der „Persönlich Ordner“ und das „Archiv“ angegeben wird soll so geändert werden, daß die Ordner-Vorgabe in einer Zelle steht – z.B. A1 oder A1:B1 (egal). Die Prozedur soll dann die Zelle auslesen und aus dem entsprechenden vorgegebenen Ordnern die Emails importieren.
Kann man das umsetzen ???
Danke im voraus
Gruß Frank
Sub GrapText()
Sheets("Tabelle1").Activate
Dim objOutlook As Object
Dim objnSpace As Object
Dim objFolder As Object
Dim objMsg As Object
Dim intCounter As Integer, intCount As Integer, iRow As Integer
Dim sTxt As String
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.folders("Persönlicher Ordner").folders("Archiv") ‘???
intCount = objFolder.Items.Count
If intCount > 0 Then
For intCounter = 1 To intCount
Set objMsg = objFolder.Items(intCounter)
objMsg.SaveAs ThisWorkbook.Path & "\temp.txt", olTXT
Close
iRow = 0
Open ThisWorkbook.Path & "\temp.txt" For Input As #1
Do Until EOF(1)
iRow = iRow + 1
Line Input #1, sTxt
Cells(iRow, intCounter).Value = "'" & sTxt
Loop
Close
Next intCounter
Kill ThisWorkbook.Path & "\temp.txt"
End If
Set objnSpace = Nothing
Set objFolder = Nothing
Set objMsg = Nothing
Set objOutlook = Nothing
End Sub