MrExcel Publishing
Your One Stop for Excel Tips & Solutions

copy files (not .xls) using an excel macro

Posted by Qroozn on October 02, 2001 3:42 PM

I am trying to automate office processes.
1. How can i use a macro to copy a file (not .xls) from one folder into another?

2. Route a file that is also not .xls.

Posted by Dank on October 03, 2001 12:47 AM

You can use VBA's Filecopy method e.g.

Sub CopyAnyFile()
Dim sSourcePath As String, sDestPath As String

sSourcePath = "c:\temp\test.txt"
sDestPath = "C:\text.txt"

FileCopy sSourcePath, sDestPath

End Sub


Posted by Qroozn on October 03, 2001 2:29 PM


TY Daniel. I'll give that one a go.

Posted by Richard S on October 04, 2001 10:06 PM

Prompt for destination name


Not being a VBer, what do I put in if I want the user to name the destination file. I extract data from a Unix box with monthly data which eventually feeds into a report. Before bring the next one across, I archive the old one. The path stays the same, but the name depends on the name of the month being archived.

TIA. This sort of thing is going to make me redundant!!