ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   unique file names (https://www.excelbanter.com/excel-programming/313320-unique-file-names.html)

Graeme R

unique file names
 

hoping someone can help me. I need to find out how to export selecte
data from excel, into a new sheet, and then save numerous times, eac
time with a unique file name. Anyone know what is the easiest way o
doing this? I have macro set up to cut and paste secial data form th
template, but as I am new to this, and frankly dumb, i am havin
trouble finding help on unique file names.

Help is appreciated if available, otherwise insanity looms large!!

Thanks in advanc

--
Graeme
-----------------------------------------------------------------------
Graeme R's Profile: http://www.excelforum.com/member.php...fo&userid=1523
View this thread: http://www.excelforum.com/showthread.php?threadid=26862


Myrna Larson

unique file names
 
Assuming you want a meaningful name, the usual approach is to include a
time-stamp as the final part of the name, e.g.

NewName = "MyWorkbook" & Format$(Now(),"yyyymmddhhmmss") & ".xls"

which has a resolution of 1 second. Now, before trying to save with that name,
you use the Dir$ function to see if that name as already been used. If so,
append a letter to make it

NewName = "MyWorkbook" & Format$(Now(),"yyyymmddhhmmss") & "A.xls"

And of course you have to see if that name is available, and if not, go to B,
etc. Generally you would use a loop at this point.

On Tue, 12 Oct 2004 14:40:29 -0500, Graeme R
wrote:


hoping someone can help me. I need to find out how to export selected
data from excel, into a new sheet, and then save numerous times, each
time with a unique file name. Anyone know what is the easiest way of
doing this? I have macro set up to cut and paste secial data form the
template, but as I am new to this, and frankly dumb, i am having
trouble finding help on unique file names.

Help is appreciated if available, otherwise insanity looms large!!

Thanks in advance




All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com