View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to block all macro when a particular file is open

You could add this to the top of every macro that shouldn't be allowed:

dim Wkbk as workbook
set wkbk = nothing
on error resume next
set wkbk = workbooks("test.xls")
on error goto 0

if wkbk is nothing then
'ok
else
msgbox "Please close test.xls first"
exit sub
end if



Dileep Chandran wrote:

Hello everybody,

Is there a way to block all the macros, when Test.xls is opened. I dont
want users to run macro in any excel file, with Test.xls kept open.

Any help is really appreciated. Thanks in advance !

-Dileep


--

Dave Peterson