From: FIRSTROUNDKO via OfficeKB.com on
Hi,

have a workbook abc****.xls in c:\myfolder\

I want to open it

**** is of variable length

I think I need to use something like

Workbooks.Open Filename:= c:\myfolder\

or maybe should I call the abc****.xls to a cell first

Thanks in advance

--
Message posted via http://www.officekb.com

From: joel on

FName = dir("c:\myfolder\*.xls")
set bk = Workbooks.Open( Filename:= FName)


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=202762

http://www.thecodecage.com/forumz

From: Dave Peterson on
Dim TestStr as string
dim wkbk as workbook

teststr = ""
on error resume next
teststr = dir("C:\myfolder\abc*.xls")
on error goto 0

if teststr = "" then
'nothing found, what should happen
else
set wkbk = workbooks.open(filename:="C:\myfolder\" & teststr)
'do stuff with wkbk???
end if


On 05/14/2010 05:39, FIRSTROUNDKO via OfficeKB.com wrote:
> Hi,
>
> have a workbook abc****.xls in c:\myfolder\
>
> I want to open it
>
> **** is of variable length
>
> I think I need to use something like
>
> Workbooks.Open Filename:= c:\myfolder\
>
> or maybe should I call the abc****.xls to a cell first
>
> Thanks in advance
>
From: FIRSTROUNDKO via OfficeKB.com on
Thank You, Perfect!

Dave Peterson wrote:
>Dim TestStr as string
>dim wkbk as workbook
>
>teststr = ""
>on error resume next
>teststr = dir("C:\myfolder\abc*.xls")
>on error goto 0
>
>if teststr = "" then
> 'nothing found, what should happen
>else
> set wkbk = workbooks.open(filename:="C:\myfolder\" & teststr)
> 'do stuff with wkbk???
>end if
>
>> Hi,
>>
>[quoted text clipped - 11 lines]
>>
>> Thanks in advance

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/excel-programming/201005/1