Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy to current workbook change to current workbook+ path

Status
Not open for further replies.

Nogi

Technical User
Dec 10, 2004
132
BE
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:

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top