In the help.
Launch Excel > choose > "Developer > Visual Basic" > Press F1 > Choose "Visual Basic for Applications Language Reference"
Also search there for "Filesystem".
- - -
But I would rather use G00gle to find some help in special Excel/Script forum.
"excel vba get cell value"
"excel vba create folder"
Examples:
- in Excel Visual Basic, insert a Module
- in Module1 insert:
Sub Macro1()
myVariable = Range("A1").Value
MsgBox myVariable
End Sub
- in excel, write something in cell A1 and execute this macro.
- next add FSO function:
- edit Macro1() to:
Sub Macro1()
myVariable = Range("A1").Value
MsgBox myVariable
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateFolder "C:\Temp\" + myVariable
MsgBox "Folder created: C:\Temp\" + myVariable
End Sub
- in excel, write something in cell A1 and execute this macro to create that folder.
Of course you have to add many more code, also for error handling, e.g. if path is valid, or if folder not already exist.
Sub Macro1()
myVariable = Range("A1").Value
MsgBox myVariable
myFolder = "C:\Temp\" + myVariable
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.folderExists(myFolder)) Then
MsgBox "Folder already exist: " + myFolder
Else
fso.CreateFolder myFolder
MsgBox "Folder created: " + myFolder
End If
End Sub
- - -
The other way around would be to use Visual Basic Script or PowerShell
to access the Excel Object, get the cell value, and invoke FSO to create the folder.