+ Reply to Thread
Results 1 to 8 of 8

What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    The thread title says it all. Could anyone suggest what I should be checking now?

    I run the code below (BTW I removed all speed hacks incl. screen updating off to see where it was going wrong), the code gets partway through the files and suddenly stops with the wbCurrentWB open. No error message. Just stops.


    WHAT I HAVE TRIED SO FAR:
    I have run the code a few times and it gets the above problem every time.

    The code stops on a different workbook each time (so that rules out anything funny to do with the .xlsx files)

    All workbooks have the worksheet that is being updated.

    I am testing this code on a local machine using a copy of the Dat File directory. (So that rules out something wrong with the WB in use code)



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

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    Runs well on my computer. Don't know what's up. Sorry!
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    I don't know what's wrong. Maybe you have a background procedure that is interrupting the code for some reason. Just a wild guess.
    Last edited by AlphaFrog; 05-30-2013 at 10:11 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    Thanks p24leclerc +1 for quick response to an urgent thread. Also thanks to the "wild guess" from Alpha Frog.

    I am marking this thread as solved - I ran it just now (in a fresh workbook) and it worked! No idea why it didn't work in the other XLSM.
    Last edited by mc84excel; 05-30-2013 at 10:50 PM.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    how were you starting the code initially?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    Hi Joseph: Inside a large XLSM (this thread was one of the side functions for that project) and it kept playing up. No idea why. Unless there was some other code interfering with it? (Also in the original XLSM the constants were on another module - but surely that wouldn't cause enough delay to cause the issue?)

    In any case, it worked when I copied the code to a new workbook so it's all good

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    I mean did you press the run button in the vbe, use the macros dialog, a button, a shortcut key or what?

  8. #8
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: What is wrong with this code? (Loop through WBs in folder - open, edit, save & close)

    I was using F5 both times.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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