Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default open a file in VB that the date changes every day.

What if the file name is always preceeded by the date. How did I get a macro
to open up a file that is named the same all the time, but has the date at
the end always change?

--
Regards,
Michael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default open a file in VB that the date changes every day.

Which is it?
What if the file name is always preceeded by the date.

DateFilename
but has the date at the end always change?

FilenameDate

Either way the filename would be like this for today's date:

Sub test()
Dim MyDate As String
Dim MyFile As String

MyDate = Format(Date, "mm_dd_yy")
MyFile = "SomeFile " & MyDate & ".xls" '= "SomeFile 10_05_05.xls"
'or
MyFile = MyDate & " SomeFile.xls" '= "10_05_05 SomeFile.xls"
End Sub

Mike F

"Michael from Austin" wrote in
message ...
What if the file name is always preceeded by the date. How did I get a
macro
to open up a file that is named the same all the time, but has the date at
the end always change?

--
Regards,
Michael



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default open a file in VB that the date changes every day.

I'm still having issues and it is beyond me. Where is what I did..

'Defining today

Dim Today As String
Today = Format(Date, "mm-dd-yy")

'Opening file NI WA Subinventory Trasactions " & Today &".xls Current file
is saved
' as " NI WA Subinventory Trasactions 10-24-05

Windows("NI WA Subinventory Transactions " & Today & ".xls").Activate

I am getting the error measage "Subscript out of Range."

What am I doing wrong?

--
Regards,
Michael


"Mike Fogleman" wrote:

Which is it?
What if the file name is always preceeded by the date.

DateFilename
but has the date at the end always change?

FilenameDate

Either way the filename would be like this for today's date:

Sub test()
Dim MyDate As String
Dim MyFile As String

MyDate = Format(Date, "mm_dd_yy")
MyFile = "SomeFile " & MyDate & ".xls" '= "SomeFile 10_05_05.xls"
'or
MyFile = MyDate & " SomeFile.xls" '= "10_05_05 SomeFile.xls"
End Sub

Mike F

"Michael from Austin" wrote in
message ...
What if the file name is always preceeded by the date. How did I get a
macro
to open up a file that is named the same all the time, but has the date at
the end always change?

--
Regards,
Michael




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default open a file in VB that the date changes every day.

I got it. I was not passing the string "Today" into the function..
Duhhhhhh... Thanks for all your help.....
--
Regards,
Michael


"Michael from Austin" wrote:

What if the file name is always preceeded by the date. How did I get a macro
to open up a file that is named the same all the time, but has the date at
the end always change?

--
Regards,
Michael

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
Incorrect date value when open DBF file in Excel officelady Excel Discussion (Misc queries) 0 September 3rd 08 05:34 AM
todays's function, if I open file date changes MaT Excel Discussion (Misc queries) 1 November 22nd 07 07:45 PM
Open file saved as today's date Lift Off[_8_] Excel Programming 11 May 14th 04 02:05 PM
Open excel file at a certain date and time hbohn Excel Programming 1 April 30th 04 09:51 AM


All times are GMT +1. The time now is 07:55 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"