エクセル研究室−Excelの基本的な使い方、応用技を紹介

フォルダを消す


フォルダを消す



'デスクトップに「test」という名前のフォルダがあればフォルダを削除します。

Sub Sample38()
'testフォルダの有無を確認
If Dir("C:\Users\Default\Desktop\test", vbDirectory) <> "" Then
'フォルダを作成
RmDir "C:\Users\Default\Desktop\test"
End If
End Sub







エクセルVBAテクニック集トップ