It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

How to create a new folder and excel file

Moderator: dafunkymunky

How to create a new folder and excel file

Postby Sharath on Fri Sep 19, 2008 10:45 am

Hi,
I need a code in EXcel VB for
1.To create a new folder
2.Insert an Excel file from other source in this folder
3.The format of excel name should be in week_date_name.xls

Pl. help me out :roll:
Sharath
 
Posts: 2
Joined: Fri Sep 19, 2008 8:39 am

Postby chubzyko on Sat Sep 20, 2008 12:21 am

Try this, you can write this code in a command button

Code: Select all
Dim foldername As String
Dim source As String, dest As String
Dim curfolder As String, newfolder As String

foldername = Name of you folder here
curfolder = "C:\"   'This is where you want to save your folder
newfolder = curfolder & "\" & foldername
MkDir (newfolder)
source = curfolder & "\" & "source.xls" 'write here the name of the file you want to insert to your folder
dest = newfolder & "\" & "week_date_name.xls"
FileCopy source, dest
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines


Who is online

Users browsing this forum: No registered users and 5 guests