User prompted date to open file

D

davethewelder

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
 
M

Mike

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

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

davethewelder

Mike, worked a treat. Thanks a lot.

Davie

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top