Create sequential file name for uploaded template

G

Guest

I have an Excel template that I would like to put on our intranet. I want it
to create a unique, sequential file name each time it is uploaded, as well as
put that unique number in a cell within the template. For example, I want the
numbering to start with 1001. When someone uploads the file, the file name
will be 1001.xls and the document number cell will be 1001. The next person
that uploads the file will be 1002.xls.
 
T

Tim Williams

How is it being uploaded? Do you have a routine which saves the file to a
specific location?
Is there only one copy or does >1 copy exist?
 
G

Guest

It will be stored on the intranet in one place with only one copy. They will
have the option as to where they want to store the file (desktop, My
Documents, etc.).
 
T

Tim Williams

(untested)
const F_PATH as string="\\servername\folder\subfolder\"
dim i as integer

i=1001

do while Dir(F_PATH & cstr(i) & ".xls")<>""
i=i+1
loop

thisworkbook.sheets("sheet1").range("A1").value=i
thisworkbook.saveas F_PATH & cstr(i) & ".xls"


Tim.
 

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