VBA BuildPath

The The FileSystemObject VBA BuildPath function will create a new path by appending a name to a given path.

VBA BuildPath Syntax

1
fso.BuildPath path, appendname

path
A path to which the appendname is to be appended to. This can be an absolute or relative path. This can end but does not need to end with a backslash.
appendname
The name to be appended to the path.

VBA BuildPath Examples

1
2
3
4
5
6
7
Set fso = CreateObject("Scripting.FileSystemObject")
 
fso.BuildPath "C:\Src", "Hello.txt" 'Result: C:\Src\Hello.txt
 
fso.BuildPath "C:\Src\", "Hello.txt" 'Result: C:\Src\Hello.txt
 
fso.BuildPath "..", "Hello.txt" 'Result: ..Hello.txt