+ Reply to Thread
Results 1 to 5 of 5

Automation error on looper file

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

    Automation error on looper file

    Hello,

    I have the attached looper file which I have probably been using for over 10 years now. Lately it has been randomly throwing automation errors where it breaks down after about the 5th loop. If I F8 through it manually it will run through all of the loops until it is complete. But running it in auto I get the automation error. Any idea what may be causing this? It is frustrating because sometimes we need it to loop through over 100 template files to stack data into one file for analysis. Any help would be appreciated. We are running it currently on 64 bit 2016 excel.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,248

    Re: Automation error on looper file

    You have a declaration of the variable "J" as "Integer" - 'Dim J As Integer' - but this variable "works" as 'Long', maybe because of that.
    Please Login or Register  to view this content.
    If 'J' does not exceed 32767, the macro works well, then it does not work ... good.
    Try to change to 'Long' and check.
    Last edited by mjr veverka; 01-24-2018 at 02:28 PM.

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

    Re: Automation error on looper file

    Dim J as Long still threw the automation error but now on the 9th loop and not the 5th.

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

    Re: Automation error on looper file

    I think I may have figured out the issue. The file path names are very very long. Is there limitations on the file path length? Or the file name length? If you look at the attachment on the File List tab you will see the paths and some of them are gigantic. I ran them through code I have to rename files and moved them to my C drive to get a shorter path and it looped through the 130 files without the automation error. I am assuming that is the issue?

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,248

    Re: Automation error on looper file


+ 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. Looper within looper
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2016, 09:43 AM
  2. Loop Nesting is returning Run-Time Error '-2147221080 (800401a8)': Automation Error
    By ChristopherBrandonKi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 02:36 PM
  3. [SOLVED] Run-tim error -2147467259(80004005): Automation error Unspecidied error
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2014, 12:12 PM
  4. [SOLVED] Looper File That opens files from a list to paste values from a cell in a list
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2014, 10:49 AM
  5. [SOLVED] looper to copy tabs of a data file into template and save as
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-26-2014, 10:47 AM
  6. Replies: 5
    Last Post: 10-08-2013, 04:33 PM
  7. Replies: 7
    Last Post: 05-15-2013, 09:02 AM

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