AatB
Gebruiker
- Lid geworden
- 15 dec 2007
- Berichten
- 257
Hallo Forum.,
onderstaande macro gebruik ik om een sheet als bijlage te versturen via Outlook.
Als deze code gestart wordt, dan wordt een nieuwe mail geopend met het excelsheet als attachment. So far, so good.
Al ik echter in Outlook een nieuwe mail aanmaak, dan staat mijn digitale handtekening er meteen onder.
Ik zou dit ook graag willen als ik deze macro opstart.
Weten jullie een oplossing?
Bedankt,
Aat
onderstaande macro gebruik ik om een sheet als bijlage te versturen via Outlook.
Als deze code gestart wordt, dan wordt een nieuwe mail geopend met het excelsheet als attachment. So far, so good.
Al ik echter in Outlook een nieuwe mail aanmaak, dan staat mijn digitale handtekening er meteen onder.
Ik zou dit ook graag willen als ik deze macro opstart.
Weten jullie een oplossing?
Bedankt,
Aat
Code:
Sub Email()
Dim OutApp As Object
Dim OutMail As Object
Dim Destwb As Workbook
Dim MailTo As String
Dim MailCopy As String
Dim MailBlindCopy As String
Dim Subject As String
Dim Body As String
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
MailTo = ActiveSheet.Range("A1").Text
MailCopy = ActiveSheet.Range("A2").Text
MailBlindCopy = ActiveSheet.Range("A3").Text
Subject = ActiveSheet.Range("A4").Text
Body = ActiveSheet.Range("A5").Text
Set Destwb = ActiveWorkbook
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.logon
Set OutMail = OutApp.createitem(0)
With OutMail
.To = MailTo
.CC = MailCopy
.BCC = MailBlindCopy
.Subject = Subject
.Body = Body
.Attachments.Add Destwb.FullName
.display
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
End Sub