Onderstaande macro heb ik gemaakt in outlook om doormiddel van mailmerge (word) te kunnen mailen vanuit een ander mailbox (Auto-Mapping).
Nu lukt het me niet om de subject aan te passen zodat hij kijkt naar 2 verschillende onderwerpen
Bv “Test” en “Voorbeeld”
mvg
Kasper
Nu lukt het me niet om de subject aan te passen zodat hij kijkt naar 2 verschillende onderwerpen
Bv “Test” en “Voorbeeld”
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error GoTo Err001
Dim objItem As Outlook.MailItem
If InStr(LCase(Item.Subject), "Test") Then
If Item.Class = olMail Then
Set objItem = Item.Copy
'Set 'From' address
objItem.SentOnBehalfOfName = "Test"
' Join Email addresses by "; " into "objItem.BCC" as string
' Remove the single quote to add BCC.
'objItem.BCC = "test@gmail.com"
' specify the file to attach
' repeat this line to add further attachments
' Remove the single quote to add Attachments.
'objItem.Attachments.Add "c:\test.pdf"
objItem.Send
Item.Delete
Cancel = True
End If
End If
Exit Sub
Err001:
MsgBox "An error occurred while sending the email!"
End Sub
mvg
Kasper