【EXCEL VBA】対象のフォルダパスに対象のテキストファイルをFileSystemObjectで作成

以下のコードで可能です。

Dim WORKBOOK_ACTIVE_PATH As String
WORKBOOK_ACTIVE_PATH = ThisWorkbook.Path

Dim objFSO As Object
Set objFSO = CreateObject("scripting.filesystemobject")
Dim strPath As String
strPath = WORKBOOK_ACTIVE_PATH & "\" & "作成するテキストファイル.txt"
    If Not objFSO.FileExists(strPath)
        objFSO.CreateTextFile(strPath)
    End If
Set objFSO = Nothing

以上です。

この記事が気に入ったらサポートをしてみませんか?