LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can't disable macros in 2nd Excel instance

I'm trying to write a routine in a "control" workbook" which will
modify an existing workbook without it being visible.

If I open the file within the existing Excel instance,
Application.Visible=False also hides the "control" workbook.

If I create a second instance of Excel and open the existing workbook
in that, I can't stop the macros from running in that workbook.

My code is:

Sub Macro2()
Dim xlApp As Object

Set xlApp = CreateObject("excel.application")
With xlApp
..EnableEvents = False
..Workbooks.Open Filename:= _
"C:\Documents and Settings\ianc\My Documents\Template Prep\II
checklist.xlt", _
UpdateLinks:=0
'
' More code here
'
..EnableEvents = True
End With
End Sub

The .EnableEvents = False should stop the macros in II Checklist.xlt
from running, but it doesn't.

If I open II Checklist.xlt in the existing Excel instance, the
EnableEvents command works as expected, but the Visible command also
hides the "control" workbook

Sub Macro2()
Application.Visible =False
Application.EnableEvents = False
Workbooks.Open Filename:= _
etc.

Any ideas where I'm going wrong.

Ian
 
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 when loading a Workbook in Excel 2000 Remy[_3_] Excel Programming 4 December 16th 05 08:07 PM
using macros to disable excel objects. bunmi Excel Programming 0 May 11th 05 06:00 PM
How do I stop Excel from prompting to enable or disable macros? ARSmythe Excel Discussion (Misc queries) 4 January 12th 05 01:07 PM
opening and running macros in an Excel file in a new instance of Excel Malone[_2_] Excel Programming 0 September 30th 03 01:58 AM
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:09 AM.

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

About Us

"It's about Microsoft Excel"