Hi,
I've been reading some posts about late binding to prevent having errors with different Office versions. I have this issue..
However, I don't know how to implement it in my own code.. :-(
Anyone willing to help me with this ??
I've been reading some posts about late binding to prevent having errors with different Office versions. I have this issue..
However, I don't know how to implement it in my own code.. :-(
Anyone willing to help me with this ??
Code:
Private Sub Exportmail_Click()
' Private Sub testmail(DisplayMsg As Boolean, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim AttachmentPath
Dim DisplayMsg
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("webmaster@somedomain.nl")
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("")
'objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Export wedstrijd"
.Body = "Export van wedstrijd" & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
AttachmentPath = Application.CurrentProject.Path & "\Export.xls"
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
.Display
.Save
.Send
End With
Set objOutlook = Nothing
End Sub