#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Automatic File Names

I am trying to create a backup file using an autoexec macro, but am
unable to find the command to put in the macro to create the file name.

I need to have the file name auto-incremental depending on what name is
in the folder.

Could anyone also tell me how to create the file name as the current
date..

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 341
Default Automatic File Names

Hello Chris,

How about this. It doesn't go and look in the folder for what is already
there, but it saves your active workbook as for example "BACKUP 080629.xls"
inside the folder you specify.

If you really want to get it to look in the folder to see what is there,
then add one, post the question under excel programming.

ActiveWorkbook.SaveAs Filename:="\\SERVER\FOLDER\"BACKUP" & Format(Year(Now)
- 2000, "00") & Format(Month(Now), "00") & Format(Day(Now), "00") & ".xls"


HTH
---
Allllen


"chrismusic79" wrote:

I am trying to create a backup file using an autoexec macro, but am
unable to find the command to put in the macro to create the file name.

I need to have the file name auto-incremental depending on what name is
in the folder.

Could anyone also tell me how to create the file name as the current
date..

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Automatic File Names

I think I'd use the time and date. It makes your code easier and even allows
you to know when the save took place based on the filename itself.

dim myFileName as string
with activeworkbook
myfilename = left(.fullname,len(.fullname)-4) & _
"_" & format(now,"yyyymmdd_hhmmss") & ".xls"

.savecopyas myfilename
end with




chrismusic79 wrote:

I am trying to create a backup file using an autoexec macro, but am
unable to find the command to put in the macro to create the file name.

I need to have the file name auto-incremental depending on what name is
in the folder.

Could anyone also tell me how to create the file name as the current
date..

Thanks.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
some kind of meta-way to refer to sheet and file names in Excel? GoBobbyGo Excel Discussion (Misc queries) 7 February 22nd 06 03:05 PM
I can't save long file names, only short one, how can I do this? short file names Excel Discussion (Misc queries) 0 January 3rd 06 05:13 PM
Weird File Open/Save As Behavior [email protected] Excel Discussion (Misc queries) 0 December 9th 05 02:26 AM
Blank File Names spinner Gordomart Excel Discussion (Misc queries) 1 December 7th 05 03:52 PM
Links picking up values from an older version of linked file Cate Links and Linking in Excel 4 October 20th 05 01:53 PM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"