Disable the "X" close button in an excel application

K

keepITcool

I dont know what you consider 'my object module'
my code is meant to go in the code module of Thisworkbook object.
NOT in a normal module. that was the whole point.


open VBE
double click ThisWorkbook in Project Explorer.
a code pane opens (or is activated) titled:
BookX.xls - ThisWorkbook
Code:
copy my code there. (and remove it anywhere else)

now you should be able to use the dropdowns at the top
of the codepane and select the General and the objects workbook and
xlapp

... note if you select xlApp in the LEFT dropdown..
the available events are listed on the Right.


From VBA help:

WithEvents Optional. Keyword that specifies that varname is an object
variable used to respond to events triggered by an ActiveX object.

WithEvents is valid only in class modules.

You can declare as many individual variables as you like using
WithEvents, but you can't create arrays with WithEvents. You can't use
New with WithEvents.

Re 'WithEvents is valid only in class modules.':
modules behind a userform, worksheet or thisworkbook
are defacto classmodules.






--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Tempy wrote :
 
T

Tempy

Hi KeepITcool,

Thanks very much, i found the problem and it working just great, thanks
for all the help and understanding.

I seem to have created quite a bit of dialog with this subject!!

Thanks again for a great job to all.

best regards,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top