Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Disable Worksheet_SelectionChange macros

Hi All.........
I am trying to disable all change-event macros (or even ALL macros) upon
opening a second workbook, with my code in the first workbook so the first
workbooks macros will function without any interference from the second
workbook macros.

I've tried

Application.EnableEvents = False
workbook.open

and tried

Sec = Application.AutomationSecurity
Application.EnableEvents = False
Application.AutomationSecurity = msoAutomationSecurityForceDisable
workbook.open

both seem to work, but when I then use a line like

Activesheet.UsedRange.SpecialCells(xlCellTypeFormu las, 23).Count

It starts to run the "Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)" macro for the Sheet in the second workbook that is active.

I would like it to NOT do that.

Any assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Disable Worksheet_SelectionChange macros

Not sure if it helps but disabling events is an application level setting. So
if you disable the events in workbook 1 then no events will fire in either
workbook. Just make darn sure you switch the events back on when you are done

Application.enableEvents = false
Activesheet.UsedRange.SpecialCells(xlCellTypeFormu las, 23).Count
applicaiton.enableevents = true
--
HTH...

Jim Thomlinson


"CLR" wrote:

Hi All.........
I am trying to disable all change-event macros (or even ALL macros) upon
opening a second workbook, with my code in the first workbook so the first
workbooks macros will function without any interference from the second
workbook macros.

I've tried

Application.EnableEvents = False
workbook.open

and tried

Sec = Application.AutomationSecurity
Application.EnableEvents = False
Application.AutomationSecurity = msoAutomationSecurityForceDisable
workbook.open

both seem to work, but when I then use a line like

Activesheet.UsedRange.SpecialCells(xlCellTypeFormu las, 23).Count

It starts to run the "Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)" macro for the Sheet in the second workbook that is active.

I would like it to NOT do that.

Any assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3


  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Disable Worksheet_SelectionChange macros

Thanks Jim, for both the response, and the important information. All is
well now in my little world......it works fine.

The solution is not in just having the right answer, but in it's proper
application.

Thanks again,
Vaya con Dios,
Chuck, CABGx3






"Jim Thomlinson" wrote:

Not sure if it helps but disabling events is an application level setting. So
if you disable the events in workbook 1 then no events will fire in either
workbook. Just make darn sure you switch the events back on when you are done

Application.enableEvents = false
Activesheet.UsedRange.SpecialCells(xlCellTypeFormu las, 23).Count
applicaiton.enableevents = true
--
HTH...

Jim Thomlinson


"CLR" wrote:

Hi All.........
I am trying to disable all change-event macros (or even ALL macros) upon
opening a second workbook, with my code in the first workbook so the first
workbooks macros will function without any interference from the second
workbook macros.

I've tried

Application.EnableEvents = False
workbook.open

and tried

Sec = Application.AutomationSecurity
Application.EnableEvents = False
Application.AutomationSecurity = msoAutomationSecurityForceDisable
workbook.open

both seem to work, but when I then use a line like

Activesheet.UsedRange.SpecialCells(xlCellTypeFormu las, 23).Count

It starts to run the "Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)" macro for the Sheet in the second workbook that is active.

I would like it to NOT do that.

Any assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3


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
Disable Macros through VBA [email protected] Excel Programming 3 January 29th 07 10:01 AM
disable macros? me[_9_] Excel Programming 1 October 28th 05 11:07 PM
Disable Macros through VBA Mirom Excel Programming 3 February 18th 04 02:03 AM
How to disable macros? LenB[_2_] Excel Programming 6 October 6th 03 07:54 PM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM


All times are GMT +1. The time now is 04:41 AM.

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"