> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# 3 Ways to Create Missing Subfolders in VBA
- URL: https://nolongerset.com/ways-to-create-subfolders/
- Published: 2022-08-17T02:54:59.000Z
- Updated: 2026-05-08T12:55:31.000Z
- Description: If you need to generate multiple levels of subfolders using VBA, these three functions will each get the job done.
- Author: Mike Wolfe
- Tags: Code Library, #FileFunctions, #Import 2026-05-20 02:59

Here are three functions that will verify a path exists and attempt to create the path (including subfolders) if it does not:

1. **[VerifyFolder()](https://nolongerset.com/recursion-demystified-creating-subfolders/)**: uses recursion and the FileSystemObject
2. **[MakeSurePathExists()](https://nolongerset.com/makesurepathexists/)**: uses the MakeSureDirectoryPathExists API function
3. **[EnsurePathExists()](https://nolongerset.com/ensurepathexists/)**: uses the Unicode-safe SHCreateDirectoryExW API function

### VerifyFolder()

I've used this function for 15 years, so it is well-tested. It also makes for a **great introduction to the topic of recursion**. That said, the Windows API options almost certainly perform better.

### MakeSurePathExists()

This approach is based on an API function–`MakeSureDirectoryPathExists`–that does exactly what it says. There is something to be said for that sort of simplicity.

That said, its major limitation is that it does not support Unicode paths.

### EnsurePathExists()

This approach relies on the `SHCreateDirectoryExW` API function to create directories if they do not exist.

---

## What Should You Use?

The short answer? **EnsurePathExists.** 

I recommend the **EnsurePathExists** function as it provides full Unicode-compatibility along with the superior performance of a Windows API function.

However, if you want to learn more about recursion, the **VerifyFolder** function is a great practical example of how recursion can make certain classes of problems much easier to solve.

---

### Referenced articles

[Recursion Demystified: Creating SubfoldersRecursion: it’s not just for calculating factorials any more! A practical example of using recursion to create multiple missing subfolders.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2020/11/mirror-510976_1920.jpg)](https://nolongerset.com/recursion-demystified-creating-subfolders/)

[MakeSurePathExists: Using the Windows API to Create Missing Subfolders in VBAA Windows API function makes verifying (and creating, if necessary) a full folder hierarchy dead simple.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/08/MakeSurePathExists.jpg)](https://nolongerset.com/makesurepathexists/)

[EnsurePathExists: A Unicode-Safe Way to Create Missing Subfolders in VBAThe EnsurePathExists function--based on the API function SHCreateDirectoryExW--is the ultimate tool for verifying and creating folder structures.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/08/EnsurePathExists.jpg)](https://nolongerset.com/ensurepathexists/)

*Image by [Gosia K.](https://pixabay.com/users/gosiak1980-2374509/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=7382049) from [Pixabay](https://pixabay.com//?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=7382049)*