Good Afternoon,
This seems to be a pretty common request, and I have tried other codes in other threads, but none of them are exactly what I am looking for.
Heres the Goal:
Create a new folder in a particular part of my server (This changes based on the information they put into the cells), rename that folder based on the data in a cell, then copy subfolders from a fixed folder location and put them in this newly created folder.
Heres what I have:
I found this link in another thread.
Sub Copy_Folder()
'This example copy all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "L:\Projects\Bid\Single Bid Template" '<< This folder wont change
ToPath = I would like this section to populated from a specific cell. (The cell wont change)
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
End If
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
FSO.CopyFolder Source:=FromPath, Destination:=ToPath
MsgBox "You can find the files and subfolders from " & FromPath & " in " & ToPath
End Sub
The cell I would like it to pull from is on a hidden sheet in my workbook.
It is Logic!$B$6
Logic B6 is: =IF(B11,B13&C9,IF(C11,C13&C9,IF(D11,D13&C9,"Status is not correct")))
and it will print out something like this: L:\Projects\(This location changes)\(This location changes)\(This name changes)
The Location it prints out is exactly where and what I would like to name the folder, so that is working, I just need that particualr cell to talk to the VBA code so it can make that.
Please let me know if you need any more information, or if there is a better way to do this.
This seems to be a pretty common request, and I have tried other codes in other threads, but none of them are exactly what I am looking for.
Heres the Goal:
Create a new folder in a particular part of my server (This changes based on the information they put into the cells), rename that folder based on the data in a cell, then copy subfolders from a fixed folder location and put them in this newly created folder.
Heres what I have:
I found this link in another thread.
Sub Copy_Folder()
'This example copy all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "L:\Projects\Bid\Single Bid Template" '<< This folder wont change
ToPath = I would like this section to populated from a specific cell. (The cell wont change)
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
End If
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
FSO.CopyFolder Source:=FromPath, Destination:=ToPath
MsgBox "You can find the files and subfolders from " & FromPath & " in " & ToPath
End Sub
The cell I would like it to pull from is on a hidden sheet in my workbook.
It is Logic!$B$6
Logic B6 is: =IF(B11,B13&C9,IF(C11,C13&C9,IF(D11,D13&C9,"Status is not correct")))
and it will print out something like this: L:\Projects\(This location changes)\(This location changes)\(This name changes)
The Location it prints out is exactly where and what I would like to name the folder, so that is working, I just need that particualr cell to talk to the VBA code so it can make that.
Please let me know if you need any more information, or if there is a better way to do this.