+ Reply to Thread
Results 1 to 9 of 9

run-time error '-2147467259 (80004005)' when sending emails via vba

  1. #1
    Registered User
    Join Date
    05-10-2019
    Location
    Winchester, England
    MS-Off Ver
    Office 365
    Posts
    9

    run-time error '-2147467259 (80004005)' when sending emails via vba

    I'm basically writing a macro to send emails to people when their tasks are overdue. I'm getting multiple problems with this. I have wrote the following code:

    Please Login or Register  to view this content.
    The email looks at the email in column 13 and sends an email to them based on the conditions wrote in the code. I have set it up so that it runs whenever the spreadsheet opens. The macro DOES do what it is intended, however, I get an error on the line "olMail.Send" saying "run-time error '2147467259 (80004005): we need to know who to send this to. Make sure you enter at least one name."

    Is there any reason for this? Whilst it does do what I need to as is, I don't like the error that's popping up, and may cause others to panic should they use this spreadsheet.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    Have you checked what the value of x is when the error ocurrs? It is possible that there is a blank cell in M on a row? (lastrow for example may be a lower row than the last email address in your M column)
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    05-10-2019
    Location
    Winchester, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    It says the value of x is 23, but I only have 22 rows in the table currently. It also says that last row is 30...I've tried to "delete" these rows to see if anything is in there but nothing changed.

    I decided to add rows up to row 31 to see if this changed anything. The same error occurred, except it says the value of x is 31 and last row is 39. Exact same thing happened when I added rows up to 107 (x = 108 and lastrow 115).

    Funnily, when I delete the rows, it still says last row is 115. So maybe this is a formatting issue?

    But you are correct. There is a blank cell in M on a row which is causing the error.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    Without the sheet I can't troubleshoot the "last row" issue, but you could always implement a check and skip any row where M is blank:

    Please Login or Register  to view this content.
    If the email column can be relied on to determine what the last row is, then you could use:

    Please Login or Register  to view this content.
    It might still be good to leave the check for blank M rows though, so that if a row in the middle doesn't have an email address, you won't get an error.
    Last edited by Arkadi; 07-11-2019 at 11:24 AM.

  5. #5
    Registered User
    Join Date
    05-10-2019
    Location
    Winchester, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    Wow this works perfectly, thank you so much!

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    Glad to hear it
    Thanks for the rep, the feedback, and marking the thread as solved!

  7. #7
    Registered User
    Join Date
    07-11-2020
    Location
    Sofia
    MS-Off Ver
    2019
    Posts
    3

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    Hello ! I am trying do deploy a similar vba code. The end goal is to load an excel file and extract some data in it including some emails. After that another macro is triggered which sends mails. Unfortunately, when there are no email addresses populated into the file, I get the same error message. Could please help me solve this issue and modify my macro. I use the following code:


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    Hi Yoanna,

    We’ll be happy to help but you’ll have to start your own thread please.

  9. #9
    Registered User
    Join Date
    07-11-2020
    Location
    Sofia
    MS-Off Ver
    2019
    Posts
    3

    Re: run-time error '-2147467259 (80004005)' when sending emails via vba

    HI, Arkadi!
    Thanks for your answer. I started a new thread

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run time error -2147467259(80004005) for using ADODB.Connection
    By VBALearn12 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-05-2019, 05:57 AM
  2. Run time error'-2147467259(80004005)':
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2014, 12:27 AM
  3. run-time error '-2147467259(80004005)':
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2014, 03:46 AM
  4. [SOLVED] Run-time error '-2147467259(80004005)'
    By Lloyd Blankfein in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-14-2013, 01:52 PM
  5. [SOLVED] Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel General
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM
  6. [SOLVED] Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel General
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM
  7. Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1