+ Reply to Thread
Results 1 to 15 of 15

Email loop only sends first email from outlook.

  1. #1
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Email loop only sends first email from outlook.

    Trying to send multiple individuals different emails based on cells within the worksheet. This basically grabs their organizational data and puts everything into an email so I can send it off and make sure everything is up to date. Problem is, it will shoot off the first email and that is it. It will still go through the whole list and say that it has emailed all contacts that have not been emailed in the last 90 days, but I do not see any emails sent from outlook.


    Please Login or Register  to view this content.
    Last edited by vamosj; 06-28-2013 at 01:52 PM. Reason: Removed the commented out loop so people should no longer be confused on why it was there.
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  2. #2
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Email loop only sends first email from outlook.

    could you upload a copy of your workbook with dummy information to preserve privacy so we can see how the macro is working?

  3. #3
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    Here's a dummy copy.

    COMMAND CONTACT LIST DUMMY LOAD.xlsm

    shootmail is the macro in question

  4. #4
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    Bumping to generate new looks... Still unresolved.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Email loop only sends first email from outlook.

    Janos

    Is there a reason the main loop in the code is commented out?

    Where can the relevant data, eg who to send email to, what to send etc, be found?
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    Yes there is, I forgot to change that when I loaded it. I figured since it was only doing it once, I was removing the loop and having to just run the macro over again with each click. The issue happens when the loop is there.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Email loop only sends first email from outlook.

    Surely you need some sort of loop if you want to send individual emails to different people?

  8. #8
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    The loop is there, I only removed it at the time because it would update the contacts page as being emailed for each email it was suppose to send. Problem one is that only the first email is going out. So if I kept the loop in there at the time, i would have to go through, see who the first email was sent to, and then erase every date after that. This is so I could send the email on occasion but if someone on the list was emailed within the past 90 days, it would skip them. That is the only reason why the loop was commented out.

    I have uploaded a fixed copy of the spreadsheet. COMMAND CONTACT LIST DUMMY LOAD.xlsm

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Email loop only sends first email from outlook.

    Janos

    I've looked at both the files you've attached but it's still unclear where, or even if, you have a list of the people you want to send emails to.

    There is one sheet, 'Update POC', that has an email address but there are no dates.

  10. #10
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    The "Update POC" tab is where it gets the main Point of Contact (POC) for each of the commands. It sends an email to that POC asking for an update for the lists (CO, XO, CMC/COB, etc..). After a good email is sent to a command, it will go back to the "Update POC" page and insert todays date into the "Last Email" column.

    The problem I have is that it will send out the email to the first one on the list that has a POC email and has not been emailed within the last 90 days (no date in block or date older than 90 days), then it will continue to run the program, inserting a "last email" date in the "Update POC" tab, but only that first email actually gets sent. This may be an issue on the Outlook side, but I wanted to see if there was any problems with my coding first.

    So in summary, the flow should look like this.
    1. Open Userform to ensure salutation, message body, and sender information are good
    2. GO2 Update POC Tab
    3. Find contact that hasn't been emailed last 90 days (If no contacts, end macro)
    4. Gather information from CO, XO, CMC/COB, JAG, Admin, & CCC tabs for the command
    5. Set up email to send by including all information gathered
    6. Send email
    7. Put date on "Update POC" for email
    8. Wait 5 seconds (to allow any computer locking during processing since government computers are oh so slow)
    9. GO2 Step 2 and repeat.

    If you want to give it a test run or two.. You can put your email in the "Update POC" tab for the three dummy commands or you can throw my email there ([email protected]) and give it some test runs.
    Last edited by vamosj; 06-28-2013 at 03:06 PM.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Email loop only sends first email from outlook.

    Hi Janos

    There's a lot of "stuff" I'd change in the Code but try this for your "shootmail" macro....seems to work for me
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  12. #12
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    If it's working for you and not me then this is probably an outlook and/or a government computer setup issue. So I will just have to revise my code and have it work it's magic one email at a time per click. Thanks for your help in this and I'll take a look at the code and see how it works for me. I'm pretty much a self taught macro with no other program language skills :-).

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Email loop only sends first email from outlook.

    Hi Janos

    Did you try the revised Code?

  14. #14
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Email loop only sends first email from outlook.

    No, not yet. Boss' priorities changed so new tasking at hand. When I get that accomplished I'll see about moving through this and seeing how it goes.

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Email loop only sends first email from outlook.

    Hi Janos

    Let me know...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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