Hello,
I've been having a few problems with sending emails from access. I've a form which has all the info on it about a particular guest. I have a button that I press to email this guest using info from the form.
I think it works fine when outlook is already open. If though outlook is closed and I'm sending the first email of the day then it seems to open outlook then open countless message composition windows in outlook, often around 50 identical ones.
Any ideas would be gratefull received! I've been trawling the internet reading lots of code from other people's emailing but I still don't really understand what the problem is.
Thanks!
Phil.
I've been having a few problems with sending emails from access. I've a form which has all the info on it about a particular guest. I have a button that I press to email this guest using info from the form.
I think it works fine when outlook is already open. If though outlook is closed and I'm sending the first email of the day then it seems to open outlook then open countless message composition windows in outlook, often around 50 identical ones.
Any ideas would be gratefull received! I've been trawling the internet reading lots of code from other people's emailing but I still don't really understand what the problem is.
Thanks!
Phil.
Code:
Private Sub cmdSendThisEmail_Click()
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)
'creates the email
With objMail
.To = Me.email
.BCC = "[EMAIL="philteare@yahoo.co.uk"]philteare@yahoo.co.uk[/EMAIL]"
.Subject = Me!sfrmCorrespondance!Subject
.Body = Me!sfrmCorrespondance!contents
.Display
End With
'Send the email without prompts
SendKeys "%{s}", True
Set objMail = Nothing
Set objOutlook = Nothing
End Sub