Sending emails using Access 2010


L

Lester Lane

Hi,
I had some code in Outlook 2003 that allowed me to bypass the annoying
messages when I sent emails from Access 2003. Now I have upgraded to
2010 and when Outlook is running my code won't even detect it nor will
it create a new instance (failed with a 429 - ActiveX can't create
error).

I also remember that 2010 can pick an account to send through and I
guess the whole routine could be made slicker. Can someone please
explain where I can find examples of code. I'm at a loss even using
the "help" screens. Thanks.

Dim objOutlook As Object ' Note: Must be late-binding.
Dim objNameSpace As Object
Dim objExplorer As Object
Dim blnSuccessful As Boolean
Dim blnNewInstance As Boolean
Dim strFailed As String
Dim i As Integer

'Is an instance of Outlook already open that we can bind to?
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application") ==== fails to find
running program
On Error GoTo ErrTrap

If objOutlook Is Nothing Then

'Outlook isn't already running - create a new instance...
Set objOutlook = CreateObject("Outlook.Application") ==== fails
with 429 can't create error
blnNewInstance = True
'We need to instantiate the Visual Basic environment... (messy)
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objExplorer =
objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)
objExplorer.CommandBars.FindControl(, 1695).Execute

objExplorer.Close

Set objNameSpace = Nothing
Set objExplorer = Nothing

End If
......... more code .......
 
Ad

Advertisements

L

Lester Lane

You may want to ask this in an Outlook newsgroup or forum. Just a guess, but
did your Access 2003 code use the Redemption.dll? If so, you'll need to set
it up the same way, with the newest version.

No it didn't use the Redemption.dll. I am trying to send an email
using Access vba. Is there nothing obviously wrong with the code then?
 
Ad

Advertisements

A

a a r o n . k e m p f

you can find some good examples of outlook automation at www.freevbcode.com
and search for outlook

hope that helps

I usually use SQL Server Reporting Services (data driven
subscriptions) to send out all the emails I need :)

-Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top