ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User prompted date to open file (https://www.excelbanter.com/excel-programming/408352-user-prompted-date-open-file.html)

davethewelder

User prompted date to open file
 
Hi, I have code to open yesterday's file from scheduled reports but I need
one where the user can enter the date of the file they require to open.

The current code is:-
basename = "Report15DetailProbability"
yesterday = Format(Date - 1, "yyyymmdd")
NewName = basename & yesterday

'
ChDir "Z:\"
Workbooks.Open Filename:="Z:\" & NewName & ".csv"
Would an inputbox do this.

Thanks in advance.

Davie

Mike

User prompted date to open file
 
basename = "Report15DetailProbability"
inputDate = InputBox("Enter date", , Format(Date, "yyyymmdd"))
NewName = basename & inputDate

MsgBox "Z:\" & NewName & ".csv"

"davethewelder" wrote:

Hi, I have code to open yesterday's file from scheduled reports but I need
one where the user can enter the date of the file they require to open.

The current code is:-
basename = "Report15DetailProbability"
yesterday = Format(Date - 1, "yyyymmdd")
NewName = basename & yesterday

'
ChDir "Z:\"
Workbooks.Open Filename:="Z:\" & NewName & ".csv"
Would an inputbox do this.

Thanks in advance.

Davie


davethewelder

User prompted date to open file
 
Mike, worked a treat. Thanks a lot.

Davie

"Mike" wrote:

basename = "Report15DetailProbability"
inputDate = InputBox("Enter date", , Format(Date, "yyyymmdd"))
NewName = basename & inputDate

MsgBox "Z:\" & NewName & ".csv"

"davethewelder" wrote:

Hi, I have code to open yesterday's file from scheduled reports but I need
one where the user can enter the date of the file they require to open.

The current code is:-
basename = "Report15DetailProbability"
yesterday = Format(Date - 1, "yyyymmdd")
NewName = basename & yesterday

'
ChDir "Z:\"
Workbooks.Open Filename:="Z:\" & NewName & ".csv"
Would an inputbox do this.

Thanks in advance.

Davie



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com