Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

file manipulation

ResolvedVersion 2003

Chris has attended:
Excel VBA Intro Intermediate course

File manipulation

How can I take a list of filenames and paths within Excel and use VBA to copy each file to a specific location?

Edited on Fri 20 Mar 2009, 11:36

RE: File manipulation

Hi Chris

Thanks for your question

You can save your file using the saveas method of the workbook object

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Development\My Documents\" & strFolder & "\" & strFile & ".xls"


strTrust is a folder in mydocuments and strFile is the file name

If you want you can create a folder using the MkDir commmand

MkDir "C:\Documents and Settings\Development\My Documents\" & strFolder


Hope that helps

Regards

Stephen

Thu 26 Mar 2009: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Counting Blanks

Some times you want to check if there are cells missing data in your range. You can use the COUNTBLANK FUNCTION to acheive this. It is =COUNTBLANK(Range). Note Cells with formulas that return "" (empty text) are also counted. Cells with zero values are not counted.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.