file manipulation
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

File manipulation

resolvedResolved · Low Priority · Version 2003

replyReply Thu 12 Mar 2009, 16:41Delegate Chris said...

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?

For upcoming training course dates see: Pricing & availability

replyReply Fri 20 Mar 2009, 11:36 Edited on Fri 20 Mar 2009, 11:36Trainer Stephen said...

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.

 

Please browse our web site to find out more about
excel-training-courses and other Microsoft training courses.

Excel tip:

Saving your Excel Spreadsheet as a CSV File

In situations where you need to save your Excel spreadsheet as a CSV file, follow these simple steps.

Click the File tab and click Save As.
Enter a name in the File name field.
Click the drop-down arrow next to the Save as type field to select the file type. Scroll down the list and select CSV (comma delimited) (*.CSV)
Click Save

The data will now be saved to a separate CSV file which can be used in different applications.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard