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

コメント

Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL