Forum Home
Press F1
 
Thread ID: 10758 2001-08-10 16:14:00 Excell Macro Guest (0) Press F1
Post ID Timestamp Content User
16801 2001-08-10 16:14:00 Hi,
I want to do a macro that save the document in a determined dir, and with the name 01.xls, 02.xls, but gives to me the choice to rename the arquive.
Guest (0)
16802 2001-08-13 13:54:00 I presume you're just after a few tips??

1.Prompt for the directory path: e.g
path=Inputbox('Enter directory','C:\My Docs\stuff')

where the second parameter is the usual directory

2. Read the first filename from that directory, then cycle through the files. Check their names, noting the last one that's in the pattern you want.

fname=dir(path) ' First call to dir
For subsequent calls to dir(), omit the parameter. It will then return the next file.

3.Once you have found the last file e.g 08.xls, generate the next name. Prompt the user again to confirm and allow a name change e.g
newname=lastnumber+1 & '.xls'

newname=inputbox('Save as ...',newname)

4. Then save it
ActiveWorkbook.SaveAs FileName:=newname

HTH

John
Guest (0)
16803 2001-08-13 14:16:00 Ok John....
Please, give to me your email...I need more help...
email to: dcyrillo@ig.com.br
Guest (0)
1