XL97: How to Trap Events for an Embedded ChartLast reviewed: March 13, 1998Article ID: Q161858 |
The information in this article applies to:
SUMMARYIn Microsoft Excel 97, you can associate a chart sheet in a workbook with a Visual Basic module. This means you can create a macro that runs when certain events occur on the chart sheet. However, this functionality does not apply to charts that are embedded on a worksheet. This article contains sample macros that trap an event for an embedded chart.
MORE INFORMATIONMicrosoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400. To trap an event for an embedded chart on a worksheet, use a WithEvents declaration on a Class Module.
Setting Up a Sample Embedded Chart
Writing the Macro Code
NOTE: If you have a Microsoft IntelliMouse and you use the scroll wheel on the mouse to scroll up or down the worksheet, the Resize event occurs if the chart is active and all or part of it is not visible on the screen.
You are resizing the Sheet1 Chart 1 chart.13. Click OK.
Disabling the Event HandlerIf you close the workbook that contains the above project, the event handler is disabled. To programmatically disable the event handler, use the following steps:
For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q158244 TITLE : XL97: How to Create Application Level Event Handlers REFERENCESFor more information about using class modules in the Visual Basic Editor, click the Index tab in Microsoft Visual Basic Help, type the following text
class moduleand then double-click the selected text to go to the "Module and Class Module Commands (Insert Menu)" topic.
|
Additional query words: 97 XL97
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |