Renaming folders with VBA

Renaming folders with VBA

To rename a folder in VBA, use MoveFolder. The first argument is the name of the folder before the change and the second argument is the name of the folder after the change.

Sub macro()
  Dim fso As Object
  Set fso = CreateObject("Scripting.FileSystemObject")
  fso.MoveFolder "c:\work_vba", "c:\work_vba2"
End Sub

コメント

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