+ Reply to Thread
Results 1 to 8 of 8

Odd macro looping issue

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Odd macro looping issue

    I've just recently upgraded from Excel 2007 to Office 365.
    I've written a macro that creates unique reports for a list of recipients (store numbers), looping through until the last and popping up a message box to tell me it's complete.
    Here's the code:

    Please Login or Register  to view this content.
    The code works...the problem is that it seems to shut down after building approximately 1/2 of the reports and sending them. It doesn't error out, it just ignores the last 30 or so of the 60 reports I'm creating, even popping up the "I'm complete" message when finished. No error, no debugging, just ignoring part of the variable srange.

    The code works (creates all 60 of the reports) IF i activate the counter lines and press OK in between each report, but that almost defeats the purpose of the macro.

    Any ideas?

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

    Re: Odd macro looping issue

    Where's the rest of the code, specifically the sub Mail_Store?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: Odd macro looping issue

    The Mail_Store code is an alteration of Ron DeBruin's code for creating a "snapshot" of data within an excel spreadsheet and pasting it into the body of an email. I've used this for several other projects with no issues (prior to conversion to Office 365).

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: Odd macro looping issue

    Norie? Any ideas? I'm stumped.
    I've even taken this exact code and run it in Excel 2007 with no issues. Something in either Excel 2013 or Outlook 2013 is partially blocking the sending of the emails. I'm hoping this is just some sort of configuration that can be changed...

    I've got this posted over on mrexcel.com also, but no response...
    Last edited by mattmickle; 04-28-2015 at 03:56 PM.

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

    Re: Odd macro looping issue

    mattmickle, when you activate the counter and have to hit ok, you are basically building in a delay between iterations of the loop. I don't know why you are getting problems, but have you tried just putting a delay in where the message box would come up with the counter? Not ideal, but maybe worth at least testing? If it works then at least you know it is a timing issue, and can move on from there... Something like
    Please Login or Register  to view this content.
    which would wait 2 seconds for each loop?
    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.

  6. #6
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: Odd macro looping issue

    Arkadi,
    One of the first things I tried. Didn't work. I went as far as 10 seconds with no success. I'm really stumped by this one...

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

    Re: Odd macro looping issue

    I see that throughout Ron's code there is On Error Resume Next, and On Error Goto 0, which as you may know disables or ignores error checking. Have you tried commenting those out just to see if you get errors THEN? If you do, you may get some insight into what is happening if the problem lies in the mail_store sub

  8. #8
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: Odd macro looping issue

    Unfortunately, tried that too. There's nothing wrong with the code. It's not erroring out. No debugger comes up. My computer is simply pretending that the last 30 or so variables in my range don't exist. My thought is something in Outlook 365 is blocking the mailings.

+ 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. Looping issue for csv clean-up macro
    By jerrydiaz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2014, 12:47 PM
  2. Looping issue
    By wani in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2012, 02:23 AM
  3. Looping Macro Issue - Infinate Loops
    By frodo987 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2012, 03:39 AM
  4. Need help with looping issue
    By SDBoca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2011, 08:18 PM
  5. Looping issue
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2005, 01:58 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