Excel vba to check if a workbook has opened -
is there way check if excel file opened or not? if opened, how can close it?
thanks in advance
if workbook name not include period character, can simple as:
sub testforopen() dim wb workbook, st string st = "phone" each wb in workbooks stwb = split(wb.name, ".")(0) if st = stwb wb.activate activeworkbook.close exit sub end if next wb end sub
this 1 looks open workbook named phone.xls or phone.xlsx or ..................
if found workbook closed.
Comments
Post a Comment