richardhubbard
asked on
Automation - Sample code to send email (via Outlook) from MS Access 2007 versions
For many years I have used code that sends email from MS Access via Outlook.
That same code does not work with the 2007 versions of Access and Outlook. I can not find any sample VBA code search Microsofts' site or internet in general.
Does anyone have working code that enable emails to be sent using MS Access and Outlook 2007.
(Plse note I have code with works for 2003 version, but it does not work for 2007)
That same code does not work with the 2007 versions of Access and Outlook. I can not find any sample VBA code search Microsofts' site or internet in general.
Does anyone have working code that enable emails to be sent using MS Access and Outlook 2007.
(Plse note I have code with works for 2003 version, but it does not work for 2007)
I am unaware of anything that may have changed in 2007, you should perhaps check to ensure the outlook reference is included as well?
Alt + F11 to open VBE
Tools : References
Lok for a tick in the Microsoft Outlook Object library
Chris
Alt + F11 to open VBE
Tools : References
Lok for a tick in the Microsoft Outlook Object library
Chris
>you should perhaps check to ensure the outlook reference is included as well?
why you have your code like this, then you need to put the Refence to Outlook:
Dim oApp As Outlook.Application
However, if your code is like this, then you don't need a Reference:
Dim oApp As object
why you have your code like this, then you need to put the Refence to Outlook:
Dim oApp As Outlook.Application
However, if your code is like this, then you don't need a Reference:
Dim oApp As object
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Makes sense in the light of something i've just been working on where I pointed out that the VBA interface in outlook 2003 was inferior in regard to checking for existing instances of outlook as well as switching to them. I commented therein that the 2007 interface may be improved, (cannot afford to upgrade so cannot say myself for sure) and your observation implies that Outlook 2007 VBA is now improved towards the capabilities of the other office apps ... which is good.
I do need to look again at the reference material though as I didn't notice that change hence my initial comment, (since it is the same as other apps I suspect I missed the connection rather than it wasn't presented).
Glad the comment helped a bit though and thanks for the info.
Chris
I do need to look again at the reference material though as I didn't notice that change hence my initial comment, (since it is the same as other apps I suspect I missed the connection rather than it wasn't presented).
Glad the comment helped a bit though and thanks for the info.
Chris
Yeah, thanks for the tip Richard
Will this make your task simpler?
http://www.febooti.com/products/command-line-email/online-help/send-email-ms-access.html
http://www.febooti.com/products/command-line-email/online-help/send-email-ms-access.html
Closed, 250 points refunded.
Vee_Mod
Community Support Moderator
Vee_Mod
Community Support Moderator
i.e.
Dim mail_item As mailitem
Set mail_item = CreateItem(0)
With mail_item
.To = my_toaddress_parameter
.Subject = my_mail_Subject_or_constan
.Body = some_kind_of_info_string
.Display
' .Send
End With
Set mail_item = Nothing
Chris