Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure


Hello,

Does anyone know how to set Excel to NOT to run any macros? or how t
disable all macros? I need to do it inside BeforeClose event handlin
procedure...

Thank you

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187053255

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure

Application.EnableEvents = False

--
HTH

Bob Phillips

"Intellihome" wrote in message
...

Hello,

Does anyone know how to set Excel to NOT to run any macros? or how to
disable all macros? I need to do it inside BeforeClose event handling
procedure...

Thank you.


--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870532558



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure


Hi Bob,

Application.EnableEvents works only for that line where it is executed

VBA goes to the next line and it switches EnableEvents back to True. S
this does not work.

But thanks any way.

Iva

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187053255

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure

"Intellihome" wrote in message
...
Application.EnableEvents works only for that line where it is executed.

VBA goes to the next line and it switches EnableEvents back to True. So
this does not work.


Completely incorrect!

--

Vasant


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure


Hello Vasant,

How do you explain this, I took it from Microsoft Support site.
here is a quote

CAUSE
This behavior can occur because, during Automation, each line of cod
that is sent to Excel to be run from an Automation client is treated a
a separate Excel macro. The EnableEvents property is turned off (set t
False) only for that one line of code, and is automatically turned bac
on (set to True) for the next line of code that is sent to Excel
Therefore, using the EnableEvents property in this context is not a
effective strategy.

and here is a link to a full article.
http://support.microsoft.com/default...b;en-us;211626

Although it is for Automation Server, I have exactly the same problem
May be I am wrong, then why EnableEvents does not work at all?

SIncerely,

Iva

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187053255



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure

That article is referring to using Excel as an automation server, and for
Excel 2000 (do you have 2000?). You did not mention that you were doing
this, using Excel as an automation server. When using VBA within a hosted
Excel application, that statement is totally incorrect as Vasant says.

--
HTH

Bob Phillips

"Intellihome" wrote in message
...

Hello Vasant,

How do you explain this, I took it from Microsoft Support site.
here is a quote

CAUSE
This behavior can occur because, during Automation, each line of code
that is sent to Excel to be run from an Automation client is treated as
a separate Excel macro. The EnableEvents property is turned off (set to
False) only for that one line of code, and is automatically turned back
on (set to True) for the next line of code that is sent to Excel.
Therefore, using the EnableEvents property in this context is not an
effective strategy.

and here is a link to a full article.
http://support.microsoft.com/default...b;en-us;211626

Although it is for Automation Server, I have exactly the same problem.
May be I am wrong, then why EnableEvents does not work at all?

SIncerely,

Ivan


--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870532558



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure


Hello Bob,

No, I am not using Automation Server, but EnableEvents works a
described in this article. and I do not know what the problem with it
It just does not work. If that is not a problem then what?

I can have for example a procedure that handles ComboBox1_Change() the
somewhere else in the code I can say:

Application.EnableEvents = False

Sheets("WhatEver").ComboBox1.Value = 1

^^^^^^^^^^^^^^^^^^^^^^^^
after this line event will be intercepted by event handler and handlin
procedure will be executed, even though EnableEvents is set to False.

Why do you think this could be?

Iva

--
Intellihom
-----------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=147
View this thread: http://www.msusenet.com/t-187053255

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default HOW TO DISABLE ALL MACROS in BeforeClose event handling procedure

I don't know. Could you post the workbook somewhere on the web (not this
NG)?

--
HTH

Bob Phillips

"Intellihome" wrote in message
...

Hello Bob,

No, I am not using Automation Server, but EnableEvents works as
described in this article. and I do not know what the problem with it.
It just does not work. If that is not a problem then what?

I can have for example a procedure that handles ComboBox1_Change() then
somewhere else in the code I can say:

Application.EnableEvents = False

Sheets("WhatEver").ComboBox1.Value = 1

^^^^^^^^^^^^^^^^^^^^^^^^
after this line event will be intercepted by event handler and handling
procedure will be executed, even though EnableEvents is set to False.

Why do you think this could be?

Ivan


--
Intellihome
------------------------------------------------------------------------
Intellihome's Profile: http://www.msusenet.com/member.php?userid=1479
View this thread: http://www.msusenet.com/t-1870532558



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove/disable event macros in SavedAs wkbk? Ed Excel Programming 5 March 22nd 05 01:42 PM
problem with beforeclose event Gordon Excel Programming 1 September 30th 04 11:21 PM
ThisWorkBook BeforeClose Event Doug Glancy Excel Programming 0 July 29th 04 12:36 AM
ThisWorkBook BeforeClose Event David Adamson[_4_] Excel Programming 0 July 29th 04 12:32 AM
BeforeClose event - Savings Mike[_40_] Excel Programming 3 September 24th 03 11:33 AM


All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"