PC Review


Reply
Thread Tools Rate Thread

Automatic File Names

 
 
chrismusic79
Guest
Posts: n/a
 
      29th Aug 2006
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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QWxsbGxlbg==?=
Guest
Posts: n/a
 
      29th Aug 2006
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.
>
>

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      29th Aug 2006
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract first names, middle names, last names and JR/SR MrsMrfy Microsoft Excel Discussion 8 7th Mar 2008 03:21 AM
File Names: List Long file Names from Database List of short file names Ben Microsoft VB .NET 4 6th May 2006 01:20 AM
Help - Names, Names, Names "Spell Checker" ? petewelch Microsoft Excel Misc 1 28th Oct 2004 01:44 PM
Names Names Names Bill William Pat Patrick P G Microsoft Access 3 9th Dec 2003 05:08 AM
Long file names vs DOS file names Jeffrey Kaplan Windows XP Help 0 2nd Nov 2003 06:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:22 AM.