Runtime Error 53 in VBA: “File not found,” explained and fixed

Error 53 — “File not found” — means the macro reached for a file at a specific path and nothing was there. The file usually exists somewhere; the path in the code and the path on the disk disagree — by a folder, an extension, or an assumption about where “here” is.

What it means

Statements like Open, LoadPicture, Shell, and DLL declarations all resolve a path at run time. If the file isn't at that exact location — or the code didn't actually specify the location it thinks it did — VBA raises 53. The error is literal: at that path, at that moment, there was no such file.

The usual causes, most common first

  1. The path is relative and the current folder isn't what the code assumes. Excel's current directory follows the last file opened or saved — not the workbook's location. This is the classic 53.
  2. The extension is wrong or doubled — Windows hides extensions, so “report.xlsx” on disk gets coded as “report.xlsx.xlsx”, or the file is really .xlsm/.csv.
  3. The file was moved, renamed, or the drive letter changed — mapped network drives are famous for this (the same share is H: on one PC, S: on another).
  4. A DLL declared in a Declare statement is missing — error 53 also fires when a declared library can't be found.
  5. Typos and trailing spaces in folder or file names built from cell values.

The fix

  1. Test the path before using it. In code: If Dir(fullPath) = "" Then — the file is not where the code thinks. Print fullPath with Debug.Print and check it character by character in File Explorer.
  2. Build paths from the workbook, not from “current folder.”
    fullPath = ThisWorkbook.Path & "\data\report.xlsx"
    ThisWorkbook.Path is where the macro's file actually lives; it never drifts.
  3. Show extensions. File Explorer → View → tick “File name extensions.” Now the real name — including any double extension — is visible.
  4. Use the full network path (UNC) — \\server\share\file.xlsx — instead of a mapped drive letter when a macro runs on more than one machine.
Do not download anything for this error. Error 53 is a path disagreement between code and disk. No cleaner or repair tool can know where the file was moved to.

If it still happens

Copy the exact path from the Debug.Print output, paste it into File Explorer's address bar, and press Enter. Explorer will show precisely which level fails — the folder, or only the file. Fix that level in the code (or restore the file there) and the error is gone. If the path is correct in Explorer but still fails in VBA, check for invisible trailing characters in the cell the name was built from (Len() the string).

Common questions

Why does it work on the author's PC and fail on mine? Relative paths and mapped drive letters. The author's machine has the file where the code assumes; yours doesn't. Full paths and ThisWorkbook.Path make macros portable.

Can error 53 be about a DLL? Yes — a Declare statement pointing at a missing library raises the same error. The fix is installing the software that provides the DLL, not downloading the DLL alone.

Related errors

Runtime Error 76 · Runtime Error 75 · Runtime Error 70