Copy an excel file to new created folder

  • Thread starter Myrna Rodriguez
  • Start date
M

Myrna Rodriguez

Hello VB addicts!
I programmed a macro to create folders on the main directory(ex: S:
directory)
When a user enters a file number in excel, a batch of folder will be
created.
For each file folder batch created, I will need to include an excel
file. How can I automate this procedure?
Currently the excel file is saved on the S: directory.

Thanks in advance for you help and continue to enjoy life!
myrna



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
B

Bob Kilmer

Look up "Workbooks Collection" in Excel Help. Look at its methods like Add,
Save and SaveAs.
 
K

Kevin

Try the following:

MkDir path

where path is a string. You can assemble the string on the
fly by concatenating the user input onto the rest of your
path statement as necessary.

Then create your file by using the SaveAs or SaveCopyAs
commands (check help). I save a copy of a workbook by
doing the following:

fileName = MyPath & SaveFileName & ".xls"

ActiveWorkbook.SaveCopyAs (fileName)

Where SaveFileName is a variable I use to assign a user
input value. fileName is also a variable that includes the
full path to the directory where the file will be saved.

Hope that helps!

Kevin
 

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