PC Review


Reply
Thread Tools Rate Thread

Date formula in file name

 
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      25th Oct 2006
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 With Quote
 
 
 
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      25th Oct 2006
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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      25th Oct 2006
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

"(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      25th Oct 2006
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
>
> "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      25th Oct 2006
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.


"(E-Mail Removed)" 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
> >
> > "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      25th Oct 2006
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

"(E-Mail Removed)" 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
> >
> > "(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      25th Oct 2006
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
>
> "(E-Mail Removed)" 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
> > >
> > > "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      25th Oct 2006
I am in the workbook and press alt+F11 then double click on workbook and this
brings up a new window

"(E-Mail Removed)" 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
> >
> > "(E-Mail Removed)" 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
> > > >
> > > > "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      25th Oct 2006
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 (E-Mail Removed) or is this not possible?

Regards,


Mark

"(E-Mail Removed)" 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
> >
> > "(E-Mail Removed)" 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
> > > >
> > > > "(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      25th Oct 2006
I will send you a workbook with the code. It will be in the
"Thisworkbook" module.

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 (E-Mail Removed) or is this not possible?
>
> Regards,
>
>
> Mark
>
> "(E-Mail Removed)" 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
> > >
> > > "(E-Mail Removed)" 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
> > > > >
> > > > > "(E-Mail Removed)" 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 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
Formula to use date in file name link reference DFruge Microsoft Excel Worksheet Functions 2 23rd May 2009 02:12 AM
Formula for file modified date Pastel Hughes Microsoft Excel Misc 3 4th Apr 2008 06:23 PM
formula to get the file save date in a cell? =?Utf-8?B?R3VtbWJ5?= Microsoft Excel Programming 7 11th Mar 2008 04:04 AM
Can I write an excel formula to display the file save date? =?Utf-8?B?Qm9iLTEyMzQ1Njc4OQ==?= Microsoft Excel Worksheet Functions 1 26th Jan 2006 07:50 PM
Create a formula that determines a date-sensitive File-Name from w =?Utf-8?B?c3Rhbi10aGUtbWFu?= Microsoft Excel Worksheet Functions 0 17th Nov 2004 03:39 PM


Features
 

Advertising
 

Newsgroups
 


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