excel vba open workbook -
my code is:
dim wb workbook dim myobj object, mysource object, file variant file = dir("c:\users\dlf164\desktop\ne\") while (file <> "") if instr(file, a) > 0 set wb = workbooks.open(file) end if file = dir wend
the error receiving application or object defined runtime error.
how solve this?
dir()
returns filename, workbooks.open()
requires full path. try this:
dim wb workbook dim myobj object, mysource object, file variant dim path string path = "c:\users\dlf164\desktop\ne\" file = dir(path) while (file <> "") if instr(file, a) > 0 set wb = workbooks.open(path & file) end if file = dir wend
Comments
Post a Comment