Create folders on a shared drive with a macro

  • Thread starter Thread starter Michael McClellan
  • Start date 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.
 
Hi Michael

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

--
XL2002
Regards

William

(e-mail address removed)

| 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.
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top