+ Reply to Thread
Results 1 to 10 of 10

Excel Can't Find File That Exists In Location

  1. #1
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Excel Can't Find File That Exists In Location

    Hi folks,

    Hopefully a quick (knock on wood) fix.

    I have a loop which is supposed to run through all files in a folder and then perform the specified code on each file.

    When I run the loop, it immediately tells me that it can't find a file in the defined location, and yet I can see the exact file it is trying to open in the exact location defined.

    Any ideas?

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Excel Can't Find File That Exists In Location

    Will help if we could see the code.

    If your looping all files in a folder, why is the code looking for a specific file name?

  3. #3
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Re: Excel Can't Find File That Exists In Location

    For the pertinent part

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Excel Can't Find File That Exists In Location

    Edit.

    Can you confirm via debug print or msgbox the variable myfiles in showing the correct file and path? Is there spacing in the folder path names causing an issue?
    Last edited by ptmuldoon; 06-27-2018 at 02:32 PM.

  5. #5
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Re: Excel Can't Find File That Exists In Location

    Does myfiles=dir not get the next file name?

    I have 2 lines saving and closing the workbook prior that; the workbook in question is also not the first workbook in the folder.

    I have read through the post and I'm failing to see what I'm missing; would you mind clarifying a little more?

    Thanks

  6. #6
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Re: Excel Can't Find File That Exists In Location

    Thanks for this. I did run a messagebox and it comes up with the filename in question. Right after the messagebox, it gives me an error box asking if the file has been moved or changed.

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Excel Can't Find File That Exists In Location

    Please Login or Register  to view this content.
    Do you have "\" at end of "*address of my files*" in your actual code?

    My guess is that path string is slightly off.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  8. #8
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Re: Excel Can't Find File That Exists In Location

    I'm actually so daft. I had forgotten a forward slash on the open command.

  9. #9
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Re: Excel Can't Find File That Exists In Location

    It works now, but after a few files I get an overflow error and I honestly don't know what I'm doing wrong

    Would I be best to open up a new thread with a new title and paste all the code?

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Excel Can't Find File That Exists In Location

    Yes, that'd be best. Please mark this thread as solved if your initial question is resolved.

+ 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. Mac excel 2016, vba copy file from one location to sandbox location
    By sujithy007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2016, 12:01 PM
  2. [SOLVED] Macro to Save Excel File to a SharePoint location and then e-mail that location in Outlook
    By NickyHavey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2016, 09:27 AM
  3. If txt file exists Then open file in Excel
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2013, 11:15 AM
  4. Copy File To (Use Dialog Box to Find Location)
    By Learn2010 in forum Access Tables & Databases
    Replies: 52
    Last Post: 09-11-2012, 08:05 AM
  5. Macro to ask to rename the file if one exists in the same location
    By debbiesh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-11-2012, 01:54 PM
  6. How we can find that whether a particular column exists in the Excel file or not
    By Progress2007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2008, 12:01 PM
  7. Excel 2003: cannot find default file location
    By Spokaneman in forum Excel General
    Replies: 1
    Last Post: 03-10-2006, 03:00 PM

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