file manipulation

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

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » File manipulation

File manipulation

resolvedResolved · Low Priority · Version 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:

Recently used file list

Under the File menu, you may find a list of files at the bottom of the menu. These files represent the most recently used Excel spreadsheets. This file list provides a quick way for you to access your files.

You can disable the file list feature of Excel. This is done by

1. Choose Tools > Options menu. You will see the Options dialog box.
2. Ensure the General tab is selected.
3. Make sure the Recently Used File List check box is cleared.
4. Click on OK.

View all Excel hints and tips


Server loaded in 0.09 secs.