ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA (https://www.excelbanter.com/excel-programming/310411-excel-vba.html)

Bryan Toma

Excel VBA
 
Need to copy external .xls file from one server and save to a different
server without opening file. Macro would go to Windows Explorer and
copy/save files without opening file. Possible?

Thanks,
Bryan

Dave Peterson[_3_]

Excel VBA
 
You can use the FileCopy inside an excel macro:

Option Explicit
Sub testme01()

FileCopy Source:="\\server01\folder01\file01.xls", _
Destination:="\\server02\folder02\file02.xls"

End Sub

But heck, you could use an old DOS command (as a .bat file???) and never even
have to open excel.

make a text file (notepad) that contains lines like:

copy "\\server01\folder01\file01.xls" "\\server02\folder02\file02.xls"

Then save it as MyBackup.Bat

Then just double click on it in explorer to test it out.

Bryan Toma wrote:

Need to copy external .xls file from one server and save to a different
server without opening file. Macro would go to Windows Explorer and
copy/save files without opening file. Possible?

Thanks,
Bryan


--

Dave Peterson



All times are GMT +1. The time now is 03:24 PM.

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