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

johnbtic

New member
Local time
Yesterday, 22:26
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:26
Joined
Oct 29, 2018
Messages
21,358
Hi John. What does the error message description say?
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
Hi DBguy

Here's the picture

VBAError.jpg
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
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!!!
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
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.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:26
Joined
Oct 29, 2018
Messages
21,358
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.
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
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.
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
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.
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
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...
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:26
Joined
Oct 29, 2018
Messages
21,358

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
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.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:26
Joined
Oct 29, 2018
Messages
21,358
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.
 

johnbtic

New member
Local time
Yesterday, 22:26
Joined
Dec 7, 2011
Messages
19
Used VBA for Outlook in the end works a treat.

Thanks for all the help much appreciated :)

John
 

Users who are viewing this thread

Top Bottom