Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula to use date in file name link reference | Excel Worksheet Functions | |||
Formula for file modified date | Excel Discussion (Misc queries) | |||
formula to get the file save date in a cell? | Excel Programming | |||
Can I write an excel formula to display the file save date? | Excel Worksheet Functions | |||
Create a formula that determines a date-sensitive File-Name from w | Excel Worksheet Functions |