Dir function

Category: File / I-O & Environment

Summary

File/folder name matching a pattern; iterate with subsequent Dir calls.

Syntax

Dir [ (pathname, [ attributes ] ) ] The Dir function syntax has these parts:
Part
Description
pathnameOptional. String expression that specifies a file name; may include directory or folder, and drive. A zero-length string ("") is returned if pathname is not found.
attributesOptional. Constant or numeric expression, whose sum specifies file attributes. If omitted, returns files that match pathname but have no attributes.

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/dir-function

Back to Functions