Hi all,
I have a question regarding adjusting a script.
The following script reads the cells in column A, and copies the corresponding foldernames from a networkpath to the location of the current workbook.
I would like to change the destination folder (as for now the current workbook) into "the current workbook" + somefolder.
Also, if possible at the end of the script, i would like the excelsheet to safe and close itself, without closing the whole excel application.
Is that possible?
Herewith attached the code:
Thanks in advance
I have a question regarding adjusting a script.
The following script reads the cells in column A, and copies the corresponding foldernames from a networkpath to the location of the current workbook.
I would like to change the destination folder (as for now the current workbook) into "the current workbook" + somefolder.
Also, if possible at the end of the script, i would like the excelsheet to safe and close itself, without closing the whole excel application.
Is that possible?
Herewith attached the code:
Code:
Sub Copy_Folders()
Application.StatusBar = "Copying files ..."
x = 1
Set fs = CreateObject("Scripting.FileSystemObject")
While Sheets("StandardItemsMatched").Cells(x, 1) <> ""
dest = ActiveWorkbook.Path & "\" & Sheets("StandardItemsMatched").Cells(x, 1)
Set f = fs.GetFolder("G:\EN\" & Sheets("StandardItemsMatched").Cells(x, 1))
f.Copy dest
' f.Delete: 'optional step
x = x + 1
Wend
fs = ""
End Sub
Thanks in advance