Copy File without opening

A

achidsey

Excel Experts,

Without opening the file, I want to copy a text file in one directory to
another directory and save it with a different name.

Specifically, I have a file C:\ACDocs\First\pa.txt"
and without opening, I want to save it as C:\ACDocs\Second\portfolio.txt"

I tried the below code but I an "Object Required" errror on the SaveCopyAs
line.

Sub Macro1()

FN1 = "C:\ACDocs\First\pa.txt"

FN1.SaveCopyAs "C:\ACDocs\Second\portfolio.txt"

End Sub

What code would work?

Thanks in advance,
Alan
 
T

Tom Ogilvy

Sub Macro1()

FN1 = "C:\ACDocs\First\pa.txt"

FileCopy FN1, "C:\ACDocs\Second\portfolio.txt"

End Sub
 
A

achidsey

Tom,

Thanks as always.

Alan

--
achidsey


Tom Ogilvy said:
Sub Macro1()

FN1 = "C:\ACDocs\First\pa.txt"

FileCopy FN1, "C:\ACDocs\Second\portfolio.txt"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top