Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy file with a macro
I want to copy a file from one folder to another with a macro. Can someone
help please? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy file with a macro
Use the FileCopy command:
Sub CopyAFile() Dim FromFileName As String Dim ToFileName As String FromFileName = "C:\Test\FileToCopy.txt" ToFileName = "C:\Test2\FileToCopy.txt" FileCopy Source:=FromFileName, Destination:=ToFileName End Sub Note that destination folder must exist, otherwise you'll get a "Path Not Found" error. Use the MkDir function to create a new folder if necessary. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Brettjg" wrote in message ... I want to copy a file from one folder to another with a macro. Can someone help please? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy file with a macro
Thankyou Chip
"Chip Pearson" wrote: Use the FileCopy command: Sub CopyAFile() Dim FromFileName As String Dim ToFileName As String FromFileName = "C:\Test\FileToCopy.txt" ToFileName = "C:\Test2\FileToCopy.txt" FileCopy Source:=FromFileName, Destination:=ToFileName End Sub Note that destination folder must exist, otherwise you'll get a "Path Not Found" error. Use the MkDir function to create a new folder if necessary. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Brettjg" wrote in message ... I want to copy a file from one folder to another with a macro. Can someone help please? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
On a DDE Linked worksheet : Copy and Paste Value to a to a file via a macro ? | Links and Linking in Excel | |||
recrding macro,copy data thn close file, get messge abut clpbord | Excel Discussion (Misc queries) | |||
Using Macro to Save Copy of File to New Location | Excel Discussion (Misc queries) | |||
creat a macro to save a copy with different file name | Excel Discussion (Misc queries) | |||
EXCEL FILE a copy/a copy/a copy ....filename | New Users to Excel |