Solved Using Access VBA to send emails in Outlook getting run-time error '-2146959355 (80080005)

johnbtic

New member
Local time
Today, 13:50
Joined
Dec 7, 2011
Messages
19
Hello all

Getting the above error. It used to work and now doesn't.

' Initiate Outlook
Dim oApp As Outlook.Application
Dim oMail As MailItem

Set oApp = CreateObject("Outlook.application")

Error occurs on the final line above.

Many thanks for any help that can be provided,

John
 
Hi John. What does the error message description say?
 
Hi DBguy

Here's the picture

VBAError.jpg
 
I think you might be some kind of a genius... I just tried to send an email and I can't find it in the send folders. I'll investigate and get back to you thanks!!!
 
Thanks DBGuy that was it. You ARE a genius! I have a dim and distant memory of seeing this a while back. I have multiple email addresses in my Outlook. So I removed them all and just added in this one and was able to send emails. It still didn't work, I think because it was downloading all the emails into Outlook. Once it was done it worked straight away!

cheekybuddha thanks for that link as well, very handy.
 
Thanks DBGuy that was it. You ARE a genius! I have a dim and distant memory of seeing this a while back. I have multiple email addresses in my Outlook. So I removed them all and just added in this one and was able to send emails. It still didn't work, I think because it was downloading all the emails into Outlook. Once it was done it worked straight away!

cheekybuddha thanks for that link as well, very handy.
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 
So it worked great. I figured it was because I let Outlook properly synchronize with gmail, just one email address now in Outlook as opposed to 3 earlier. Now it's not working again. Same error. I can send an email in Outlook but the code isn't working.
 
Does anyone know of a way to write code directly to gmail? I tried to do that originally and couldn't do it so I figured I'd write to Outlook instead.
 
What I think is interesting as well is that the VBA command is just when it's trying to connect to Outlook it's not like it's trying to create or send an email...
 
Hey DBGuy it works for sending emails which is handy. I'm looking to cycle through the gmail folders and delete certain emails. Not sure how that'll work.
 
Hey DBGuy it works for sending emails which is handy. I'm looking to cycle through the gmail folders and delete certain emails. Not sure how that'll work.
For that, you'll probably need to use Google API.
 
Used VBA for Outlook in the end works a treat.

Thanks for all the help much appreciated :)

John
 

Users who are viewing this thread

Back
Top Bottom