Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
In Excel 2002, I want to write code that uses a file that's been store
with the current/todays date. Can't figure out how to identify th file name since it changes everyday. Know it's got to be simple, but tried all combinations and it hang up. Workbooks.Open Filename:= _ "C:\Documents and Settings\LiftOff\Desktop\ & Date.xls" TIA, Lift Of -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Lift Off,
This works for me: Workbooks.Open Filename:= "C:\Documents and Settings\Anders\Desktop\" & date & ".xls" HTH Anders Silven "Lift Off " skrev i meddelandet ... In Excel 2002, I want to write code that uses a file that's been stored with the current/todays date. Can't figure out how to identify the file name since it changes everyday. Know it's got to be simple, but tried all combinations and it hangs up. Workbooks.Open Filename:= _ "C:\Documents and Settings\LiftOff\Desktop\ & Date.xls" TIA, Lift Off --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
If the date is formatted, use something like
Workbooks.Open Filename:= "C:\Documents and Settings\Anders\Desktop\" & _ Format(Date, "yyyy-mm-dd") & ".xls" -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Anders S" wrote in message ... Lift Off, This works for me: Workbooks.Open Filename:= "C:\Documents and Settings\Anders\Desktop\" & date & ".xls" HTH Anders Silven "Lift Off " skrev i meddelandet ... In Excel 2002, I want to write code that uses a file that's been stored with the current/todays date. Can't figure out how to identify the file name since it changes everyday. Know it's got to be simple, but tried all combinations and it hangs up. Workbooks.Open Filename:= _ "C:\Documents and Settings\LiftOff\Desktop\ & Date.xls" TIA, Lift Off --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Anders: Tried that but I guess the format of the file name is wrong.
Your method looks for mm/dd/yyyy. My file name is mmm/dd. I guess can save the file differently, but I not such a long name. Any othe suggestions? TIA Lift Of -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
See my answer and adapt the format, but drop the /, filenames don't like it.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Lift Off " wrote in message ... Anders: Tried that but I guess the format of the file name is wrong. Your method looks for mm/dd/yyyy. My file name is mmm/dd. I guess I can save the file differently, but I not such a long name. Any other suggestions? TIA Lift Off --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Thanks Bob, That worked and I'm able to open. But the code now hangs u
as elsewhere I try to activate the worksheet and it hangs up on th date again, but I'm using the correct format. i.e. same format as opened the workbook. Code is: Windows(" & Format(Date, "mmm dd") & ".xls").Activate Am I missing a space somewhere? The date is ''mmm dd" with out a das between. TIA BTW, always wanted to ask.....where's Poole Harbour? -- Message posted from http://www.ExcelForum.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Lift Off,
My file name is mmm/dd Is that really possible? Use Bob's code. You may experiment with the format in the Immediate window to get it right like ?format(Date, "mmm-dd") Regards Anders Silven "Lift Off " skrev i meddelandet ... Anders: Tried that but I guess the format of the file name is wrong. Your method looks for mm/dd/yyyy. My file name is mmm/dd. I guess I can save the file differently, but I not such a long name. Any other suggestions? TIA Lift Off --- Message posted from http://www.ExcelForum.com/ |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Anders: Sorry typo. My file name format is: mmm dd.xls
Windows(" & Format(Date, "mmm dd") & ".xls").Activate I get a syntax error with the above code. Lift Off --- Message posted from http://www.ExcelForum.com/ |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
This code
Windows(" & Format(Date, "mmm dd") & ".xls").Activate seems to be missing something, a single open quote should give you a compile error. Make sure that you use the workbook name, not the fullname which includes the path. But, you shouldn't need it, because as soon as you open it, that workbook becomes the active workbook. Poole Harbour is on the south coast of England, in the county of Dorset, next to the Dorset World Heritage Coastline. The harbour is renowned as the second largest natural harbour in the world (in terms of perimeter distance), only beaten by Sydney harbour. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Lift Off " wrote in message ... Thanks Bob, That worked and I'm able to open. But the code now hangs up as elsewhere I try to activate the worksheet and it hangs up on the date again, but I'm using the correct format. i.e. same format as I opened the workbook. Code is: Windows(" & Format(Date, "mmm dd") & ".xls").Activate Am I missing a space somewhere? The date is ''mmm dd" with out a dash between. TIA BTW, always wanted to ask.....where's Poole Harbour?? --- Message posted from http://www.ExcelForum.com/ |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Bob: This is the copied code:
Windows(" & Format(Date, "mmm dd") & ".xls").Activate It does give a compile error and syntax error, highlighting the "mmm". I open the workbook, go to others and need to come back and activat the opened later. Basically, that's the flow. Lift Of -- Message posted from http://www.ExcelForum.com |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
Try using intdate = Day(Date) & "_" & Month(Date) & "_" & Year(Date) Workbooks.Open Filename:= _ "C:\Documents and Settings\LiftOff\Desktop\" & intdate & ".xls" -----Original Message----- In Excel 2002, I want to write code that uses a file that's been stored with the current/todays date. Can't figure out how to identify the file name since it changes everyday. Know it's got to be simple, but tried all combinations and it hangs up. Workbooks.Open Filename:= _ "C:\Documents and Settings\LiftOff\Desktop\ & Date.xls" TIA, Lift Off --- Message posted from http://www.ExcelForum.com/ . |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open file saved as today's date
The problem is that leading ".
IT is treating the (" & Format(Date, " as the workbook id, and then wonders what the mmm is all about,so errors. Try Windows(Format(Date, "mmm dd") & ".xls").Activate -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Lift Off " wrote in message ... Bob: This is the copied code: Windows(" & Format(Date, "mmm dd") & ".xls").Activate It does give a compile error and syntax error, highlighting the "mmm". I open the workbook, go to others and need to come back and activate the opened later. Basically, that's the flow. Lift Off --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date open file with date saved | Excel Worksheet Functions | |||
Reading File Name in VB Macro that contains today's date | Excel Discussion (Misc queries) | |||
excel 2003 saved file will not open without a blank workbook open | Excel Discussion (Misc queries) | |||
Export a file with today's date | Excel Programming | |||
on open goto cell with today's date | Excel Programming |