Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default auto_open macro

I have a macro that runs everytime I open a new book after it is ran the
first time. I have to close Excel to open a new book without it running.
What is causing this problem? I've tried changing the name of the macro
without "auto_open".

Sub Change()

Application.OnWindow = "Restore_menus"

Application.Windows("test2.xls").OnWindow = "Disable_menu"

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default auto_open macro

I am guessing Change the macro that was named Auto_Open.

In any event, I would say that

Application.OnWindow
sets an application level event.

So anytime a window is activated (such as opening a new workbook) that Macro
(Restore_Menus) will be run.

If you want it workbook level, perhaps then

Application.Windows("test2.xls").OnWindow = "Restore_menus"

rather than

Application.OnWindow = "Restore_menus"

--
Regards,
Tom Ogilvy


"travis" wrote:

I have a macro that runs everytime I open a new book after it is ran the
first time. I have to close Excel to open a new book without it running.
What is causing this problem? I've tried changing the name of the macro
without "auto_open".

Sub Change()

Application.OnWindow = "Restore_menus"

Application.Windows("test2.xls").OnWindow = "Disable_menu"

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default auto_open macro

Thank you, Tom.

Yes, at one point the macro was named "Auto_Open", I thought maybe that was
the problem. It wasn't. This was very helpful.

Travis

"Tom Ogilvy" wrote:

I am guessing Change the macro that was named Auto_Open.

In any event, I would say that

Application.OnWindow
sets an application level event.

So anytime a window is activated (such as opening a new workbook) that Macro
(Restore_Menus) will be run.

If you want it workbook level, perhaps then

Application.Windows("test2.xls").OnWindow = "Restore_menus"

rather than

Application.OnWindow = "Restore_menus"

--
Regards,
Tom Ogilvy


"travis" wrote:

I have a macro that runs everytime I open a new book after it is ran the
first time. I have to close Excel to open a new book without it running.
What is causing this problem? I've tried changing the name of the macro
without "auto_open".

Sub Change()

Application.OnWindow = "Restore_menus"

Application.Windows("test2.xls").OnWindow = "Disable_menu"

End Sub

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
Auto_Open Macro Trying to Excel Excel Discussion (Misc queries) 2 April 13th 07 07:08 AM
auto_open-macro Mr.T Excel Programming 1 November 22nd 05 11:25 AM
Disable event macro while Auto_open() run Sunil Patel Excel Programming 2 June 30th 05 06:41 PM
Help with SaveAs Macro on Auto_Open Daen Excel Programming 3 September 15th 04 11:08 PM
Auto_Open vs. macro John Wilson Excel Programming 0 September 22nd 03 05:44 PM


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