Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello, Everyday when I come in I have to open the an excel file from th previous day. For instance, today I had to open workbook 8-30.xls and tomorrow Ill have to open workbook 9-1.xls. I was thinkin there might be a way to have this open for me automatically when I ope Excel. Any ideas on what the macro for this should look like? Thanks -- ForSal ----------------------------------------------------------------------- ForSale's Profile: http://www.excelforum.com/member.php...fo&userid=1189 View this thread: http://www.excelforum.com/showthread.php?threadid=40133 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Add this to the ThisWorkbook module of your PERSONAL.xls file;
Private Sub Workbook_Open() Dim flname As String Dim path As String path = "C:/Temp/" On Error Resume Next flname = Month(Date) & "-" & Day(Date) & ".xls" Workbooks.Open (path & flname) On Error GoTo 0 End Sub Hope this helps Rowan "ForSale" wrote: Hello, Everyday when I come in I have to open the an excel file from the previous day. For instance, today I had to open workbook 8-30.xls and tomorrow Ill have to open workbook 9-1.xls. I was thinking there might be a way to have this open for me automatically when I open Excel. Any ideas on what the macro for this should look like? Thanks. -- ForSale ------------------------------------------------------------------------ ForSale's Profile: http://www.excelforum.com/member.php...o&userid=11896 View this thread: http://www.excelforum.com/showthread...hreadid=401337 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think that the OP wanted yesterday's date. So this line:
flname = Month(Date) & "-" & Day(Date) & ".xls" could be: flname = Month(Date-1) & "-" & Day(Date-1) & ".xls" or just: flname = format(date-1,"m-d") & ".xls" Rowan wrote: Add this to the ThisWorkbook module of your PERSONAL.xls file; Private Sub Workbook_Open() Dim flname As String Dim path As String path = "C:/Temp/" On Error Resume Next flname = Month(Date) & "-" & Day(Date) & ".xls" Workbooks.Open (path & flname) On Error GoTo 0 End Sub Hope this helps Rowan "ForSale" wrote: Hello, Everyday when I come in I have to open the an excel file from the previous day. For instance, today I had to open workbook 8-30.xls and tomorrow Ill have to open workbook 9-1.xls. I was thinking there might be a way to have this open for me automatically when I open Excel. Any ideas on what the macro for this should look like? Thanks. -- ForSale ------------------------------------------------------------------------ ForSale's Profile: http://www.excelforum.com/member.php...o&userid=11896 View this thread: http://www.excelforum.com/showthread...hreadid=401337 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display yesterday's date but only for weekdays? | Excel Worksheet Functions | |||
Date open file with date saved | Excel Worksheet Functions | |||
Can I restore yesterday's file? | Excel Discussion (Misc queries) | |||
Open file and print sheets based on data in cell | Excel Programming | |||
VBA to call file based on date | Excel Discussion (Misc queries) |