2021年8月10日 星期二

[VBA] 讓 VBA 程式幫你定期新增資料夾

 每個月的月初都要新增一堆月度資料夾,不如直接讓程式幫你完成!



Sub updateFolder()

Dim months As String

Dim d As Date

d = Date

If (Day(d) = 1) Then '如果日期在1號的話

    months = Year(d) & month(d) & Day(d)  '資料夾名稱

    Path = "C:\Users\User\Desktop\月度報表\" & months  '路徑

    MkDir Path '新增

End If


End Sub


沒有留言:

張貼留言