Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Check if workbook is open...

I have a workbook that runs a macro when it open. I have a second workbook
that needs to open the first workbook and import data. How do I prevent the
opening macro from running when the other workbook opens it?

Using Excel 2003

Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Check if workbook is open...

put your open code in a standard module called Auto_Open. it will only run when
the workbook is opened manually not via code.

if you have your code in a workbook_open module, it will fire whether the
workbook is opened manually or via code.

--


Gary


"John" wrote in message
...
I have a workbook that runs a macro when it open. I have a second workbook
that needs to open the first workbook and import data. How do I prevent the
opening macro from running when the other workbook opens it?

Using Excel 2003

Thanks in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Check if workbook is open...

hi
disable events.

Application.EnableEvents = False
Workbooks.Open Filename:= _
"C:\my\file\path\FileWithOnOpenMacro.xls"
Application.EnableEvents = True

this should disable the on open macro.
regards
FSt1

"John" wrote:

I have a workbook that runs a macro when it open. I have a second workbook
that needs to open the first workbook and import data. How do I prevent the
opening macro from running when the other workbook opens it?

Using Excel 2003

Thanks in advance!

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
Check for open workbook Oldjay Excel Programming 3 April 17th 08 11:09 AM
If Then to check if a workbook is open Shawn Excel Discussion (Misc queries) 5 November 25th 06 04:29 PM
Check if workbook is already open... Cumberland[_9_] Excel Programming 1 August 22nd 06 09:16 AM
How check if workbook open? Ian Elliott Excel Programming 7 April 14th 06 08:54 PM
Check for open workbook georgio Excel Programming 2 November 20th 04 11:03 PM


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