【VBA】Create folder

You can create folder!

PR

VBA Code

As an example, create folder “hogehoge”.

Option Explicit

Sub sampleProc()
    
    Dim fso As Object
    Dim folderFullPath As String
    
    'Set "Folder path"
    folderFullPath = "C:\Users\user\Desktop\hogehoge"
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    'Create folder
    fso.CreateFolder (folderFullPath)
    
    Set fso = Nothing
    
End Sub

Set “Folder path”(Line 9).

Create folder(Line 14).

PR

Result

You created folder!

Result
Result
PR

FYI

For more information about following, see the following official online manual:

CreateFolder method” of “FileSystemObject”

タイトルとURLをコピーしました