ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening a file with changing dates (https://www.excelbanter.com/excel-programming/365350-opening-file-changing-dates.html)

kingkdz

Opening a file with changing dates
 

I want to open a file which has a filename ABC followed by anything. I
thought this should have worked, but it is not.

Set Wkb2 = Workbooks.Open(Filename:=foldername & "\ABC*")

Can someone please correct it? Thanks in advance


--
kingkdz
------------------------------------------------------------------------
kingkdz's Profile: http://www.excelforum.com/member.php...o&userid=35783
View this thread: http://www.excelforum.com/showthread...hreadid=555483


Bob Phillips

Opening a file with changing dates
 
fName = Dir(foldername & "\ABC*")
if fName < "" Then
Set Wkb2 = Workbooks.Open(Filename:=fName)
End If


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kingkdz" wrote in
message ...

I want to open a file which has a filename ABC followed by anything. I
thought this should have worked, but it is not.

Set Wkb2 = Workbooks.Open(Filename:=foldername & "\ABC*")

Can someone please correct it? Thanks in advance


--
kingkdz
------------------------------------------------------------------------
kingkdz's Profile:

http://www.excelforum.com/member.php...o&userid=35783
View this thread: http://www.excelforum.com/showthread...hreadid=555483




kingkdz[_2_]

Opening a file with changing dates
 

Thanks. But it is still saying file not found while the file it is
quoting as not found is right there in the folder!! Weird.


--
kingkdz
------------------------------------------------------------------------
kingkdz's Profile: http://www.excelforum.com/member.php...o&userid=35783
View this thread: http://www.excelforum.com/showthread...hreadid=555483


kingkdz[_3_]

Opening a file with changing dates
 

Anyone has an alternative to this? Please

--
kingkd
-----------------------------------------------------------------------
kingkdz's Profile: http://www.excelforum.com/member.php...fo&userid=3578
View this thread: http://www.excelforum.com/showthread.php?threadid=55548



All times are GMT +1. The time now is 12:06 PM.

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