The information in this article applies to:
SYMPTOMSWhen you reference the Application property to Quit an OLE object, Visual FoxPro terminates. This article illustrates how to remove or hide an OLE Chart object and explains how the Application property behaves with OLE objects. CAUSE
Each Visual FoxPro object has an Application property that refers to the
Visual FoxPro application object. Because that object has a Quit method,
invoking that method terminates the Visual FoxPro session.
Provides a reference to the Application object containing an object.In this case, the Application object is Visual FoxPro. WORKAROUNDSince an Excel chart object does not have a Quit property, you must use properties available in Visual FoxPro. First, if you want to remove the object from the form, call the RemoveObject method of the form. For example:
This removes the object from the form without quitting Visual FoxPro.
Second, if you simply need to hide the OLE object, set the Visible property of the object to false (.F.). For example:
The method you choose depends on whether you need to access the
OLEContainer again. Toggling the Visible property between True and False is
faster than invoking the AddObject method. However, if you truly want to
remove the object from the form, the RemoveObject method is preferable.
STATUSThis behavior is by design. MORE INFORMATIONIn the example below, you want to remove the Excel chart from the form. However, the command in step 2 causes the following error: As the error states, the object referenced, the Excel chart, does not have a Quit property. By adding the Application property to the command, no error occurs and Visual FoxPro closes. Since the Application property refers to Visual FoxPro and not Excel, the program exits Visual FoxPro. The Object Browser application in Excel provides information on the properties available for use with Excel objects. Steps to Reproduce Behavior
REFERENCESFor more information about properties and methods available to the Application Object, search for "Application Object" and then "Properties" or "Methods" in the Visual FoxPro Help file. Also see the following articles in the Microsoft Knowledge Base: Q156548 How To Use the object Property to Reference Methods/Properties Q155747 How To Use the New Application Property in VFP 5.0For more information about Excel's Object Browser, please see the following article in the Microsoft Knowledge Base: Q142128 XL: How to Find Visual Basic for Application Help Additional query words: kbdsd VFoxWin
Keywords : kbVFp500 kbVFp600 FxinteropOle |
Last Reviewed: December 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |