Create folders on a shared drive with a macro

  • Thread starter Michael McClellan
  • Start date
M

Michael McClellan

I would like a macro that would create a folder on one of our shared
drives and would name this folder based on what is in one of the cells
in the current worksheet. Does anyone have a clue how to do this?
Any help is appreciated.
 
W

William

Hi Michael

Sub test()
Dim x As String
x = "R:\MyExistingFolder\" & Range("A1")
On Error Resume Next
MkDir x
End Sub

--
XL2002
Regards

William

[email protected]

| I would like a macro that would create a folder on one of our shared
| drives and would name this folder based on what is in one of the cells
| in the current worksheet. Does anyone have a clue how to do this?
| Any help is appreciated.
 
B

Bob Phillips

Michael,

This creates a folder on the D drive.

Dim oFSO As Object
Dim oFolder As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.CreateFolder("D:\" & ActiveSheet.Range("A1"))

Haven't tested on a shared drive, but as long as you have access, and the
drive is mapped, it should work.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top