excel - Check if pptx and xlsx files are already open before attempt to open it -
i guess easy 1 since i'm new in vba can't figure out.
i have peace of code opens power point presentation , excel spreadsheet. dir_pptx
, dir_xlsx
respective filepaths.
set objppt = createobject("powerpoint.application") set objpresentation = objppt.presentations.open("" & dir_pptx & "") workbooks.open filename:=dir_xlsx
my question: how modify code check if files opened and, if are, don't open again?
sub wbcheck() each b in application.workbooks if b.name = dir_xlsx msgbox b.name & " open" 'exit sub or other handler else workbooks.open filename:=dir_xlsx end if next end sub
Comments
Post a Comment