Outlook VBA Application_ItemSend aan uit zetten

Status
Niet open voor verdere reacties.

Tweety1

Gebruiker
Lid geworden
6 mrt 2013
Berichten
637
Ik weet niet of het mogelijk is om een soort knop/Taak te maken die de macro uit of aan kan zetten?
Ik gebruik deze macro om vanuit word een mail merge te verzenden.
Er is namelijk geen mogelijkheid om bij de mail merge namens iemand anders te mailen (Auto-Mapping).
Via onderstaande stukje macro lukt het wel.

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error GoTo Err001

Dim objItem As Outlook.MailItem

If Item.Class = olMail Then
        Set objItem = Item.Copy
        
        'Set 'From' address
        objItem.SentOnBehalfOfName = "test@test.nl"
        
        
        ' Join Email addresses by "; " into "objItem.BCC" as string
        ' Remove the single quote to add BCC.
        'objItem.BCC = "test1@test.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
Exit Sub

Err001:
 MsgBox "An error occurred while sending the email!"
End Sub

mvg

Kasper
 
Dit zijn geen Word mailmergeopdrachten.
 
Dat klopt. Ik weet ook niet of het mogelijk is vanuit outlook/word
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan