Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default In Excel 2007 how to switch off macro with a macro

Spreadsheet "A" runs a macro that opens spreadsheet "B". It gets data and
then closes "B" without saving (other spread sheets access "B" and deposit
data). A, then uses data for report.

However, when "B" opens it runs its own macros (the code doesn't ask it to
do this) and this creates a mess.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default In Excel 2007 how to switch off macro with a macro

Micky
Apparently, Workbook B has code that runs automatically when that file
is opened. What you have to do is either change that code so that it does
you no harm or delete it. Post back if you need more. HTH Otto
"Micky" wrote in message
...
Spreadsheet "A" runs a macro that opens spreadsheet "B". It gets data and
then closes "B" without saving (other spread sheets access "B" and deposit
data). A, then uses data for report.

However, when "B" opens it runs its own macros (the code doesn't ask it to
do this) and this creates a mess.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 224
Default In Excel 2007 how to switch off macro with a macro


If B's macros are being run from B's Workbook_Open event, then use
Application.EnableEvents:

Dim bEnableEvents as Boolean
bEnableEvents = Application.EnableEvents
Application.EnableEvents = False
'<open B here
Application.EnableEvents = bEnableEvents

But that won't help if B's macros are being run from an auto_open
macro. In that case, since you're only reading data, you could leave B
closed and read the data from A either with formulas or with an ODBC
query.

Another option if you're in charge of the other workbooks' macros:
From the macros in the other workbooks that write to B, or in B's

Workbook_BeforeClose event, save out text files with the data. Then
open those text files in A instead of opening B.


Greg Lovern
http://PrecisionCalc.com


On Sep 24, 1:44 pm, Micky wrote:
Spreadsheet "A" runs a macro that opens spreadsheet "B". It gets data and
then closes "B" without saving (other spread sheets access "B" and deposit
data). A, then uses data for report.

However, when "B" opens it runs its own macros (the code doesn't ask it to
do this) and this creates a mess.



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
Macro that can switch between tabs JorgeG.ACT Excel Programming 26 July 17th 08 03:45 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
How do I create a macro to switch sheets suzie Excel Programming 2 January 19th 06 09:40 PM
Trying to switch to a different sheet in a macro? BigDave[_10_] Excel Programming 7 June 14th 05 06:44 PM
Macro : switch between excel and word Tom Excel Programming 4 November 19th 04 09:23 AM


All times are GMT +1. The time now is 12:06 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"