Create a folder in One drive using Excel VBA

Chandrakanth Gajawada 1 Reputation point
2022-07-09T12:18:53.97+00:00

I am trying to create a folder in One Drive using Excel VBA but I am getting a run time error. Please help

Sub Script()

Folderpath = (Application.ActiveWorkbook.Path) & "/"
usrdt = Format(Date, "DDMMMYYYY") & "-" & Format(Now(), "HHmmss")
VBA.FileSystem.MkDir (Folderpath & usrdt)

End Sub

Microsoft 365 and Office Development Other
Developer technologies Visual Basic for Applications
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.