Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Date formula in file name

Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Date formula in file name

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Date formula in file name

Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Date formula in file name

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Date formula in file name

Mark, there is nothing wrong with the code:
ActiveWorkbook.SaveAs Filename:="Stock_
as of " & Format(Date, "yyyy-mm-dd") & ".xls"

Just make sure you don't drop any of the quote marks, periods, commas,
parentheses or ampesand.


" wrote:

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Date formula in file name

Sorry to be pain but all text is RED except for End Sub, and still not
working, must be doing something wrong do I have to run macro or anything
else, when I save the file only returning the name I give it?

Mark

" wrote:

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Date formula in file name

No Problem. We'll get it worked out. Are you placing this code in the
workbook module?

santaviga wrote:
Sorry to be pain but all text is RED except for End Sub, and still not
working, must be doing something wrong do I have to run macro or anything
else, when I save the file only returning the name I give it?

Mark

" wrote:

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Date formula in file name

I am in the workbook and press alt+F11 then double click on workbook and this
brings up a new window

" wrote:

No Problem. We'll get it worked out. Are you placing this code in the
workbook module?

santaviga wrote:
Sorry to be pain but all text is RED except for End Sub, and still not
working, must be doing something wrong do I have to run macro or anything
else, when I save the file only returning the name I give it?

Mark

" wrote:

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks






  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Date formula in file name

Mark,

I emailed the workbook. However, as I mentioned in my email, the
problem was the line breaks in the code you picked up when you copied
from the site to your workbook.

Alan


santaviga wrote:
Can you possibly e-mail to me a one that you do so I can look up what you've
done, just a test document to or is this not possible?

Regards,


Mark

" wrote:

No Problem. We'll get it worked out. Are you placing this code in the
workbook module?

santaviga wrote:
Sorry to be pain but all text is RED except for End Sub, and still not
working, must be doing something wrong do I have to run macro or anything
else, when I save the file only returning the name I give it?

Mark

" wrote:

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks







  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Date formula in file name

Thanks a lot Alan, much appreciated for your Help dude.

Just starting out on VBA

Thanks again

Mark

" wrote:

Mark,

I emailed the workbook. However, as I mentioned in my email, the
problem was the line breaks in the code you picked up when you copied
from the site to your workbook.

Alan


santaviga wrote:
Can you possibly e-mail to me a one that you do so I can look up what you've
done, just a test document to or is this not possible?

Regards,


Mark

" wrote:

No Problem. We'll get it worked out. Are you placing this code in the
workbook module?

santaviga wrote:
Sorry to be pain but all text is RED except for End Sub, and still not
working, must be doing something wrong do I have to run macro or anything
else, when I save the file only returning the name I give it?

Mark

" wrote:

What section is appearing in red? I tested before posting and it
worked fine.

santaviga wrote:
Hi,

I have done this in VB came up with error, OK'd it and now text red, closed
VB and tried saving file and not inputting date when looking at the file name

Mark

" wrote:

Try this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveWorkbook.SaveAs Filename:="Stock as of " & Format(Date,
"yyyy-mm-dd") & ".xls"
End Sub

santaviga wrote:
Hi,

I'm looking to see if possible a date is inserted before or after the file
name on saving.

e.g. Stock as of 25/10/2006 (this as the file name auto updated when the
file is saved by the user.

Is this possible???

Thanks








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
Formula to use date in file name link reference DFruge[_2_] Excel Worksheet Functions 2 May 23rd 09 02:12 AM
Formula for file modified date Pastel Hughes Excel Discussion (Misc queries) 3 April 4th 08 06:23 PM
formula to get the file save date in a cell? Gummby Excel Programming 7 March 11th 08 04:04 AM
Can I write an excel formula to display the file save date? Bob-123456789 Excel Worksheet Functions 1 January 26th 06 07:50 PM
Create a formula that determines a date-sensitive File-Name from w stan-the-man Excel Worksheet Functions 0 November 17th 04 03:39 PM


All times are GMT +1. The time now is 08:03 PM.

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

About Us

"It's about Microsoft Excel"