OPEN WORKBOOK

  • Thread starter FIRSTROUNDKO via OfficeKB.com
  • Start date
F

FIRSTROUNDKO via OfficeKB.com

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
 
D

Dave Peterson

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
 
F

FIRSTROUNDKO via OfficeKB.com

Thank You, Perfect!

Dave said:
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
[quoted text clipped - 11 lines]
Thanks in advance
 

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