XL7: Code to Access MS Excel Does Not Work in Version 7.0 (138723)
The information in this article applies to:
- Microsoft Excel for Windows 95
This article was previously published under Q138723 SYMPTOMS
In earlier versions of Microsoft Excel, you can create Visual Basic or
C/C++ code to allow another application to access a currently running
instance of Microsoft Excel. To do this, you use code similar to the code
in the following examples:
VB Code Example
Dim myExcelApp As Object
Set myExcelApp = GetObject(, "Excel.Application")
C/C++ Code Example
LPOLESTR lpszProgID = OLESTR("Excel.Application");
LPUNKNOWN pUnk;
if (FAILED(CLSIDFromProgID(lpszProgID, &clsid)))
return;
HRESULT hr =GetActiveObject(clsid,NULL,pUnk);
This code will not work with Microsoft Excel version 7.0, even if Microsoft
Excel is running.
CAUSE
Earlier versions of Microsoft Excel register the application object in the
OLE RunningObjectTable (ROT) on startup. This registration occurs under all
circumstances, regardless of whether Microsoft Excel is started by OLE.
However, Microsoft Excel 7.0 does not register the application object in
the ROT on startup by default.
STATUS
This change in Microsoft Excel 7.0 is by design.
Modification Type: | Minor | Last Reviewed: | 8/17/2005 |
---|
Keywords: | kbNoUpdate KB138723 |
---|
|