ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy file while in use (https://www.excelbanter.com/excel-programming/307132-copy-file-while-use.html)

Todd huttenstine

Copy file while in use
 
Hey guys

How do you programmatically copy a file while its in use?

Lets say the file is "Test.xls". Test.xls is located in
C:\Hey directory. This is the open file. I want to copy
it from C:\Hey to C:\Bye.


How would I do this?

Thanks
Todd Huttenstine

Tom Ogilvy

Copy file while in use
 
workbooks("Test.xls").SavecopyAS "C:\Bye\Test.xls"

--
Regards,
Tom Ogilvy

"Todd Huttenstine" wrote in message
...
Hey guys

How do you programmatically copy a file while its in use?

Lets say the file is "Test.xls". Test.xls is located in
C:\Hey directory. This is the open file. I want to copy
it from C:\Hey to C:\Bye.


How would I do this?

Thanks
Todd Huttenstine




Rob Bovey

Copy file while in use
 
Hi Todd,

If this file is in use because it is open in the same instance of Excel
that your code is running in you can use the Application.SaveCopyAs method
to save a copy to a different location. If the file is in use by some other
instance of Excel you're out of luck. You just have to wait until it's no
longer being used.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Todd Huttenstine" wrote in message
...
Hey guys

How do you programmatically copy a file while its in use?

Lets say the file is "Test.xls". Test.xls is located in
C:\Hey directory. This is the open file. I want to copy
it from C:\Hey to C:\Bye.


How would I do this?

Thanks
Todd Huttenstine




Todd huttenstine

Copy file while in use
 
Thanks guys.


Todd
-----Original Message-----
Hey guys

How do you programmatically copy a file while its in use?

Lets say the file is "Test.xls". Test.xls is located in
C:\Hey directory. This is the open file. I want to copy
it from C:\Hey to C:\Bye.


How would I do this?

Thanks
Todd Huttenstine
.



All times are GMT +1. The time now is 05:44 PM.

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