+ Reply to Thread
Results 1 to 3 of 3

Issue Using DIR() to Find and Open File Using a Wildcard

  1. #1
    Registered User
    Join Date
    05-15-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    2

    Issue Using DIR() to Find and Open File Using a Wildcard

    I'm having some issues using DIR(), the code below (which I found on this forum ) worked fine when I first set it up and ran it. I was able to run it multiple times with it opening and copying the information wanted. The issue is that once I close Excel and reopened the file, the code will no longer work and it's giving me a run-time error 1004: application-defined or object-defined error when trying to execute the line of code Workbooks.Open wbName (or atleast that when it stop executing but could it be the line above?). If I open another workbook and add this code, it will again work until I save/close/reopen. As you can probably tell, I'm by far no expert in VBA, I'm thinking that wbName is being stored with the file path and file name and it's not clearing out when I close and reopen Excel?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Issue Using DIR() to Find and Open File Using a Wildcard

    Try

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-15-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Issue Using DIR() to Find and Open File Using a Wildcard

    I wish I would have humbled myself on Friday and instead of spending 3+ hours searching around and working on the code for an answer and just came here right from the start. 5 minutes and I had my answer I believe this can be labeled as solved, thank you for your time!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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