From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Determine if a folder (directory) exists

Determine if a folder (directory) exists - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Determine if a folder (directory) exists

- [Instructor] In the previous movie, I showed you how to check, to determine whether a file with a specific name existed or not. In this movie, I will show you how to do the same thing, but in this case, instead of looking for a file, we're looking for a directory. The sample workbook that I'll start in is 0202, check for folder. And you can find that in the chapter two folder of the exercise files collection. We'll run our code from this workbook. So we won't actually use any of the data in the worksheet. So I'll press Alt + F11 to move to the Visual Basic editor. And here I have a code module, Module1, and I have a function and a sub-routine that will call the function. The function as the name implies, PathThere, looks to see if a particular directory path is available. For this exercise, we'll look to see if the chapter two folder of the exercise files collection is present on your system. That means that…

Contents