excel - Determine if file exists -


i want open workbook variable in archive list.

if don't have file in archive, want show message box, did not work.

strvariable = left(pictureno, 4) d = "teknik resim arsiv listesi_" & strvariable & ".xls" dim ret ret = workbooks.open(thisworkbook.path & application.pathseparator & d)  if ret = false     msgbox "not found" end if 

check existence of file before attempting open it:

strvariable = left(pictureno, 4) d = "teknik resim arsiv listesi_" & strvariable & ".xls" if dir(thisworkbook.path & application.pathseparator & d) = ""     msgbox "not found" else     dim wb workbook     set wb = workbooks.open(thisworkbook.path & application.pathseparator & d) end if 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -