How to load these XLS files

J

Jako

I am receiving workbooks from someone who is using the filename a
follows : <TodaysDate> NW AB.XLS

For example today i received a workbook with this filname...

180704 NW AB.xls

and tomorrow i will receive a workbook named

190704 NW AB.xls

Also the received files are stored in C:\CASTLE\NORTH WEST\

Please could someone tell me how to programmatically write some code t
auto load the file received without having to browse for th
file.Obviously it has something to do with Format Date but am unsure f
exactly how to do this. Also before loading the file i want to copy th
received file into D:\RECEIVED\NORTH WEST\

Thanks in advance
 
B

Bob Phillips

Workbooks.Open Filename:= "C:\CASTLE\NORTH WEST\" & _
Format(Date,"ddmmyy") & " NW AB.xls"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Tom Ogilvy

Dim s1 as String, s2 as Strnig, sName as String
s1 = "C:\CASTLE\NORTH WEST\"
s2 = "D:\RECEIVED\NORTH WEST\"
sName = format(Date,"ddmmyy") & " NW AB.xls"
filecopy s1 & sName, s2 & sName
workbooks.open s1 & sName
 
J

Jako

Many thanks that works a treat.

Could you please tell me how i delete the file from

"C:\CASTLE\NORTH WEST\"

after copying it.

Also i don't want to be prompted if i want to delete the file.

Cheer
 
T

Tim Coddington

Name is actually a move, not a copy. I'm sure you could do the
name command, then open the sheet on the D: drive to use it. A
little modification of Tom's code should do the trick.

But, for future reference, the keyword to look up in help is KILL.
 
T

Tim Coddington

Oops. Sorry. Name doesn't work across devices. I guess you do need the
KILL after all.

Tim Coddington said:
Name is actually a move, not a copy. I'm sure you could do the
name command, then open the sheet on the D: drive to use it. A
little modification of Tom's code should do the trick.

But, for future reference, the keyword to look up in help is KILL.
 

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