Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Create a New Folder in the Specified Location


The below code would create a folder with the name "Test" in the path C:\ if not already exist.

' Add Reference to Microsoft Scripting Runtime

Sub CreateFolder()
Dim MyFSO As FileSystemObject
Set MyFSO = New FileSystemObject
If MyFSO.FolderExists("C:\Test") Then
    MsgBox "The Folder Already Exist"
Else
    MyFSO.CreateFolder ("C:\Test")
    MsgBox "Folder Created"
End If
End Sub


Subscribe

Enter your e-mail below and get notified on the latest blog posts.




Tags

VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts


Follow Us