+ Reply to Thread
Results 1 to 8 of 8

Help with workbooks.open

  1. #1
    Registered User
    Join Date
    10-26-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Help with workbooks.open

    Hi I am using the vba command
    workbooks.open(filepath & file)
    I get an error message when the specified filepath and file combination do not exist, as you might expect.

    Is there any way to ignore this? The rest of my code is a set of loops to change the file name, following a structured format, so I know that certain file names don't exist whilst others do. I only want it to return data from files which do exist and ignore ones that don't.

    Thanks

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with workbooks.open

    Hi ictfc

    Welcome to the Forum!!!

    There's several ways to handle this:
    Please Login or Register  to view this content.
    Or:
    Please Login or Register  to view this content.
    Or:
    Please Login or Register  to view this content.
    And my personal preference...see this link...
    http://www.excelguru.ca/content.php?157
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Help with workbooks.open

    The quick solution is like this

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-26-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Help with workbooks.open

    Hi, thanks for the replies. I tried both approaches my code now skips the first file it can not find but for the next file it still gives me an error.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with workbooks.open

    Hi ictfc

    At a minimum post your entire revised Code...a Sample File might be helpful...post your entire revised Code first.

  6. #6
    Registered User
    Join Date
    10-26-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Help with workbooks.open

    Here is my complete code
    Please Login or Register  to view this content.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with workbooks.open

    Hi ictfc

    I'd suggest this is not your ACTUAL COMPLETE Code.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with workbooks.open

    Hi ictfc

    This Code compiles and runs...have no clue it it does as you require.
    Please Login or Register  to view this content.

+ 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. [SOLVED] Open workbooks update the main one and close the other workbooks
    By stojko89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2013, 07:12 AM
  2. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM
  3. Replies: 14
    Last Post: 08-17-2012, 10:54 AM
  4. Replies: 1
    Last Post: 01-02-2006, 11:30 PM
  5. Replies: 0
    Last Post: 12-30-2005, 04:35 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