View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ivan Raiminius Ivan Raiminius is offline
external usenet poster
 
Posts: 258
Default Opening a file with date extension

Hi John,

sPath = "C:\test"
sFilename = "My Import File*.xls"
if len(dir(spath & "\" & sfilename))=0 then
msgbox "No file"
else
sFilename = spath & "\" & dir(spath & "\" & sfilename)

dim wb as workbook
set wb = workbooks.open sfilename

end if

You can move "dim wb as workbook" into top of the procedure, if you
prefer this location or to the top of the module to be able to work
with wb in other procedures within the module.

Regards,
Ivan