Skip to content

Instantly share code, notes, and snippets.

@bigarabuza
Last active August 29, 2019 10:23
Show Gist options
  • Save bigarabuza/3f17ae6f9482b2268cb85219d27a2939 to your computer and use it in GitHub Desktop.
Save bigarabuza/3f17ae6f9482b2268cb85219d27a2939 to your computer and use it in GitHub Desktop.
Working with FileSystemObject
Option Explicit
'create instance of FileSystemObject (Early binding: enables intellisense)
Dim objFSO As New FileSystemObject
'create instance of FileSystemObject (Late binding: mitigates issue of user referencing library)
Dim objFSO as Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'create new folder
objFSO.CreateFolder("C:\Users\bennyboo9\Documents\Test")
'get folder
objFSO.GetFolder(""C:\Users\bennyboo9\Documents\Test")
'check if folder exists
if objFSO.FolderExists("C:\Users\bennyboo9\Documents\Test")
Then MsgBox "Folder Exists."
Else
MsgBox "Folder does not exist."
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment