If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > saving files (VBA)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-12-04, 05:54
kolevn kolevn is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
Question saving files (VBA)

Hello,

I would appreciate help with VBA.

I have written a macro that performs a computation every day. I would like to save the computation daily with a different name. For example, I would like to call the result with the current date as the file name. How can I do this?

Many thanks,

Nick
Reply With Quote
  #2 (permalink)  
Old 02-12-04, 10:44
kolevn kolevn is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
My question was rather trivial. I apologize. I used VBA today for the first time.

Anyhow, here is one way to do what is required (saving the files on the Desktop):

Sub GiveNameAsDate()
Dim SendPath, NameFile, SaveAsFile, DateNow
SendPath = "C:\Documents and Settings\Desktop\"
DateNow = Application.Text(Now(), "dd.mm.yyyy;@")
NameFile = "FileName"
SaveAsFile = DateNow
NameFile = NameFile & SaveAsFile
ActiveWorkbook.SaveAs Filename:=SendPath & NameFile, _
FileFormat:=xlNormal, CreateBackup:=False
End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On