+ Reply to Thread
Results 1 to 6 of 6

How to resume this code on error

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    How to resume this code on error

    I seem not to be able to pinpoint the correct position in following piece of code to resume on error.
    It runs thru a predefined range with workbook names to open.
    However when it does not find the workbook to open it should just continiou with the following.
    But I cannot get it to work with 'on error resume' etc.
    Please Login or Register  to view this content.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to resume this code on error

    You could just use Dir to check if the file exists:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: How to resume this code on error

    Thanks! That indeed looks like a better way.
    However this stops after 1 file?
    My list has 10 files but in the folder there are only 2 files.
    This just does 1 and stop then.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to resume this code on error

    I'd have to guess the other file names don't match then. Try stepping through the code.

  5. #5
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: How to resume this code on error

    Nope that is not it. Thought about the naming.
    So I changed the name of the file which gets imported.
    So then there is only 1 name which matches. And then it does import that file.
    Name cannot be the problem.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to resume this code on error

    There is nothing in that code that would exit after processing one file. Did you try stepping through the code?

+ 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. Code to Stop on Object if Error / fix it/ resume
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2014, 08:48 AM
  2. VBA -- pouse code to enter data in a worksheet, and then resume code
    By jcm4ccc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2013, 12:59 PM
  3. Error pops up on line On Error Resume Next
    By Erusso in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-20-2012, 04:57 PM
  4. On error resume next
    By dugdugdug in forum Access Tables & Databases
    Replies: 15
    Last Post: 10-10-2012, 08:30 AM
  5. On Error Resume Next
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-20-2010, 10:35 AM

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