Solved

How to stop a macro Excel 5.0

Posted on 1998-11-26
8
283 Views
Last Modified: 2008-01-09
I 've got a Auto_open macro in a sheet. I open another sheet of the same type (with the same Auto_open macro). Then I try to close the first one. At the moment I use the second one, the first one is reopened, presumably to execute its macro. How to prevent that ? I tried to do an "End" command, but to no avail ...
0
Comment
Question by:phl
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Expert Comment

by:cartti
ID: 1614667
Can you clarify your question ? This is how I understood it. You have an Auto_Open macro in one Workbook. In the code of that macro, you open another workbook. You then close the first workbook. From when you say 'At the moment I use the second on....' I've lost you.

Is there only one macro which is in the first workbook, or are there more ?
0
 

Expert Comment

by:hammerts
ID: 1614668
Try opening the sheet with the SHIFT key held down, this will not run any auto-open macros , you can then edit anything.
0
 

Author Comment

by:phl
ID: 1614669
In fact I want the macro to stop by itself, with no human intervention. More information is needed i see :) :
Each WORKBOOK I use contains the same macros (Auto_open and others). Thess macros are :
Sub Auto_open()
    Application.OnSheetActivate = "Init"
End Sub

and calls :

Sub Init()
    Application.OnEntry = "NameOfSub"
End Sub

(...)

Then each time I enter a value, the "NameOfSub" macro is used. But I would like that each workbook uses its own macro instead of using the macro belonging to the first opened workbook.
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Accepted Solution

by:
cartti earned 100 total points
ID: 1614670
Use this syntax to avoid Excel being confused as to what macro to use:

Application.OnEntry = name of workbook file & "!NameOfSub"
0
 
LVL 2

Expert Comment

by:cartti
ID: 1614671
Sorry, add the name of the module to the syntax to be certain. So...

Application.OnEntry = name of workbook file & "!" & name of module & ".NameOfSub"
0
 
LVL 5

Expert Comment

by:vboukhar
ID: 1614672
You have just use more clear description of your sub:
Sub Auto_open()
Application.OnSheetActivate = ActiveWorkbook.Name & "!Init"
End Sub

Sub Init()
Application.OnEntry = ActiveWorkbook.Name & "!NameOfSub"
End Sub
Check it!
0
 
LVL 5

Expert Comment

by:vboukhar
ID: 1614673
Sorry, I've not seen cartti answer.
0
 

Author Comment

by:phl
ID: 1614674
Thanks cartti ! (and vboukhar too :) ) . See you later ... :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question