for each wbk in workbooks
if wbk.name = ThisWorkbook.name then
'do nothing
elseif lcase(wbk.name) = lcase("daily report.xls") then
'skip this, too
elseif lcase(left(wbk.name,4))= lcase("npp_") then
'skip more!
else
wbk.close savechanges:=false 'or true????
end if
next wbk
Greg H. wrote:
>
> How can i modify this to prevent thisworkbook.name and another excel file not
> to close? I need the files "Daily Reports.xls" and "NPP_*" to stay open.
> Thanks
>
> "Joel" wrote:
>
> > Easy
> >
> > for each wbk in workbooks
> > if wbk.name <> ThisWorkbook.name then
> > workbooks(wbk.name).close
> > end if
> > next wbk
> >
> > "anon" wrote:
> >
> > > HI,
> > >
> > > I'd like my wb on opening to close all other excel files that are open
> > > (prompting them to save first).
> > >
> > > I'd also like to prevent the user opening any other excel files whilst
> > > my wb is open.
> > >
> > > Is this possible (and is it a stupid thing to try and do?)
> > >
> > >
--
Dave Peterson
|