+ Reply to Thread
Results 1 to 5 of 5

Automation Error - Exception Occurred when looping through files

  1. #1
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Automation Error - Exception Occurred when looping through files

    Hello,

    I am running a looper. I have used this code for probably the last 10 years. All of a sudden it is throwing an automation error - exception occurred and then excel shuts down. I am running 64bit 2016 excel as of a few months ago. Any ideas if there is something in the code that is causing this?


    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,053

    Re: Automation Error - Exception Occurred when looping through files

    If the macro has not been changed and has been working for the last ten years, it is either a problem with the list of files or it is something to do with the file that is being processed.

    Put some debug statements in the loop and print the loop number (I), and strFileName

    I would suggest that you manually step through the loop as, if Excel crashes, you'll lose the debug output.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Re: Automation Error - Exception Occurred when looping through files

    what's weird is sometimes it bombs on the 20th file. other times it will pass that file and maybe go to 100. it seems random. It is the same files it is looping through.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,053

    Re: Automation Error - Exception Occurred when looping through files

    Code looks ok. Not much to go wrong.

    Maybe try running it after you've just rebooted your machine. Clean environment, just Excel loaded.

  5. #5
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Re: Automation Error - Exception Occurred when looping through files

    Not it looks like it is running ok. Crazy.

+ 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. Solver - Automation Error Exception Occured
    By godonnell06 in forum Excel General
    Replies: 5
    Last Post: 03-23-2016, 04:43 AM
  2. MS Excel w/ userform & macros - Receive "Automation error Exception ocurred" message
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-25-2014, 01:54 AM
  3. Excel com exception when running remote automation
    By ampicillin in forum Excel General
    Replies: 0
    Last Post: 11-12-2013, 03:08 AM
  4. Excel Automation: Setting WindowState throws exception in Excel2013
    By Anandh123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2013, 02:02 AM
  5. [SOLVED] UserForm Error - Exception Occurred
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-02-2011, 11:26 AM
  6. User Form - Exception Occurred
    By Riggers in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2011, 05:03 PM
  7. Exception Occurred excel form vba
    By cclambie in forum Excel General
    Replies: 0
    Last Post: 12-08-2005, 11:20 PM

Tags for this Thread

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