+ Reply to Thread
Results 1 to 4 of 4

Dir () , Workbooks.Open stopped working

  1. #1
    Registered User
    Join Date
    02-27-2015
    Location
    West
    MS-Off Ver
    2010 Professional
    Posts
    18

    Dir () , Workbooks.Open stopped working

    I have a macro that I have been using for some time to find and open a set of files to gather data. Suddenly it is not working.

    Please Login or Register  to view this content.
    I get

    Please Login or Register  to view this content.
    I have changed the Workbooks.Open line to this:

    Please Login or Register  to view this content.
    and now it works. The original code still works on my other machine. Why the change??

    Between the time that it last worked and the time that it first gave me a problem, I stopped to fix a form control a second spreadsheet. The button clears the filters from a ListObject and it wasn't working. I saw some references to FilterMode and AutoFilterMode on the forum for that issue, and when I threw Debug.Print AutoFilterMode into the sub I got a weird result that seemed to be referencing back to the first spreadsheet. After that I returned to the first one and ran into this issue.

    So what gives? Just trying to understand. Thanks in advance.
    Last edited by vlookup.; 05-28-2015 at 05:48 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Dir () , Workbooks.Open stopped working

    Dir doesn't return the path, and Open requires that either the file be in the current directory or the path be fully included.

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-27-2015
    Location
    West
    MS-Off Ver
    2010 Professional
    Posts
    18

    Re: Dir () , Workbooks.Open stopped working

    Hi shg, lucky me that your computer has not been washed away in the floods.

    I download these data files onto my Desktop then immediately run the macro. So what you're saying is my Desktop has been the current directory up till this morning, and now it is not? I have used this code for about six weeks now, and this is the first time I've run into a problem.

    So how does the current directory get set or changed?

    Thx

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Dir () , Workbooks.Open stopped working

    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] workbooks.open not working in xl2010 but works in xs2003
    By symaxf in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2013, 11:35 PM
  2. Defining workbook variable not working with workbooks.open
    By hmbugg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2013, 02:09 PM
  3. Replies: 2
    Last Post: 10-22-2012, 09:55 AM
  4. Private Sub Worksheet_Change stops working when I have certain workbooks open.
    By forth250 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-12-2008, 03:47 PM
  5. [SOLVED] Problem with Macro working in new workbooks that I open
    By chris_rip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2005, 03:06 PM

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