View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier[_3_] Jon Peltier[_3_] is offline
external usenet poster
 
Posts: 57
Default Locking other Excel sheets from intermingling with my Excel App

Randy -

Prevent other workbooks from running your code by inserting a line like
this around your event procedures:

If ActiveWorkbook.Name = ThisWorkbook.Name Then
' run the code
End If

You could also use an application event class module to show particular
custom commandbar buttons when your workbook is activated, and hide them
when your book is deactivated.

These things will let your workbook coexist peacefully with anyone else's.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Randy wrote:
When users open my Excel Application all is ok until they
open another sheet. A few things happen:

1) The new sheet shares the active window of my Excel App.
2) Sometimes based on the event the new sheet calls macros
in my application.

I know I could use Application.IgnoreRemoteRequests=True
to eliminate this completely but if that value is not set
before the app closes it creates a mess will any Excel
sheets the user may wish to open. Not good if a system
crash occurs. So therefore not an option.

What other options do I have? I have been trying all
kinds of things. You would think Excel would have
something that would Make an application a true and
separate application......

Any ideas?

Thanks!