ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create folders on a shared drive with a macro (https://www.excelbanter.com/excel-programming/300108-create-folders-shared-drive-macro.html)

Michael McClellan

Create folders on a shared drive with a macro
 
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.

William[_2_]

Create folders on a shared drive with a macro
 
Hi Michael

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

--
XL2002
Regards

William



"Michael McClellan" wrote in message
om...
| 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.



Bob Phillips[_6_]

Create folders on a shared drive with a macro
 
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)

"Michael McClellan" wrote in message
om...
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.





All times are GMT +1. The time now is 03:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com