AatB
Gebruiker
- Lid geworden
- 15 dec 2007
- Berichten
- 253
Hallo,
ik zoek een manier om meerdere bijlages via outlook vanuit excel vba macro te versturen.
Ik weet hoe ik 1 bijlage kan versturen.
Weet iemand hoe het veld attachment gevuld moet worden voor meerdere attachments?
mvg,
Aat
ik zoek een manier om meerdere bijlages via outlook vanuit excel vba macro te versturen.
Ik weet hoe ik 1 bijlage kan versturen.
Weet iemand hoe het veld attachment gevuld moet worden voor meerdere attachments?
mvg,
Aat
Code:
Function MakeMail(mailto, mailcc, mmailbcc, subject, attachment)
Dim OutApp As Object
Dim OutMail As Object
'Error 429 occurs with GetObject if Outlook is not running.
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If Err.Number = 429 Then 'Outlook is NOT running.
MsgBox "Outlook is not running"
Else
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = mailto
.cc = mailcc
.bcc = mailbcc
.subject = subject
.Attachments.Add attachment
.Display
End With
End If
End Function