jerry0110
Erfahrenes Mitglied
Hallo zusammen,
ich habe in meinem Postfach 100 Mails und diese möchte ich mit einem Standardtext beantworten.
Auslesen vom Postfach bekomme ich hin. Aber nicht das reply von der gefundenen Email:
Habe zwar was im Netz gefunden....versteh da aber wirklich nur Bahnhof. Und ich denke, dass man das in ein Makro machen kann. Und nicht in 3.
ich habe in meinem Postfach 100 Mails und diese möchte ich mit einem Standardtext beantworten.
Auslesen vom Postfach bekomme ich hin. Aber nicht das reply von der gefundenen Email:
Visual Basic:
Option Explicit
Public Sub mailTest()
Const C_MAPI = "jerry5428@hotmail.com"
Const C_FOLDER = "Posteingang"
Const C_Test = "Test"
'Das Test-Mail auslesen
Dim otl As Outlook.Application
Dim ns As Outlook.Namespace
Dim fld As Outlook.MAPIFolder
Dim mail As Outlook.MailItem
Set otl = New Outlook.Application
Set ns = otl.GetNamespace("MAPI")
Set fld = ns.Folders(C_MAPI).Folders(C_FOLDER).Folders(C_Test)
For Each mail In fld.Items
If mail.ReceivedTime Like "*21.02.2020*" Then
xxxxxxxxxxxxxxxxxxxxxxxxx
End If
Next
End Sub
Habe zwar was im Netz gefunden....versteh da aber wirklich nur Bahnhof. Und ich denke, dass man das in ein Makro machen kann. Und nicht in 3.
Visual Basic:
Public Sub Reply_1()
Dim Subject As String, Msg As String
Subject = "Re: "
Msg = "Beispiel-Text 1"
ReplyMail Subject, Msg
End Sub
Private Sub ReplyMail(Subject As String, Msg As String)
Dim obj As Object
Dim oReply As Outlook.MailItem
If TypeOf Application.ActiveWindow Is Outlook.Inspector Then
Set obj = Application.ActiveInspector.CurrentItem
Else
With Application.Selection
If .Count Then
Set obj = .Item(1)
End If
End With
End If
If obj Is Nothing Then Exit Sub
If TypeOf obj Is Outlook.MailItem Then
Set oReply = obj.Reply
If InStr(1, oReply.Subject, Subject, vbTextCompare) = 0 Then
oReply.Subject = Subject & obj.Subject
oReply.Body = Msg & vbCrLf & vbCrLf & oReply.Body
End If
oReply.Display
End If
End Sub