The information in this article applies to:
SYMPTOMSWhen you use the GetObject function with a filename in a Microsoft Visual Basic version 3.0 procedure to open a Microsoft Excel workbook, and then use the Quit method to quit Microsoft Excel, the following error message appears:
CAUSEWhen you use the GetObject function with a filename to open a file, the OLE Automation object that is created is a Worksheet object, not an Application object. This error occurs when you use the Quit method with a Worksheet object, because the Quit method does not apply to a Worksheet object. WORKAROUND
Microsoft 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 professionals 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.
Method 1Use the Parent property to return the Application object and use the Quit method as in the following Visual Basic procedure:
Method 2Use the class argument of the GetObject function to return the Application object as the OLE Automation object. Then open the desired workbook file as in the following Visual Basic procedure:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATIONFor additional information, please see the following articles in the Microsoft Knowledge Base: Q111247 XL OLE Automation: Workbook Hidden Using GetObject Function Q134835 Automation Error Using Excel Object in Visual Basic Procedure REFERENCESFor more information about the Quit Method, click the Search in the Visual Basic Reference and type: Quit Method Additional query words: 3.00
Keywords : kbinterop kbprg |
Last Reviewed: October 19, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |