Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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
Date open file with date saved Rita Excel Worksheet Functions 3 April 23rd 09 03:13 PM
Reading File Name in VB Macro that contains today's date dhstein Excel Discussion (Misc queries) 10 November 13th 08 02:48 AM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
Export a file with today's date Grek Excel Programming 5 April 30th 04 11:24 AM
on open goto cell with today's date Tom Ogilvy Excel Programming 1 September 14th 03 10:56 PM


All times are GMT +1. The time now is 10:47 AM.

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

About Us

"It's about Microsoft Excel"