Microsoft KB Archive/172278

= XL97: Error Message Appears Returning MSGraph Object Name =

Article ID: 172278

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Graph 97
 * Microsoft Excel 97 Standard Edition
 * Microsoft Office 97 Standard Edition

-



This article was previously published under Q172278



SYMPTOMS
When you create a macro that references a property of a Microsoft Graph object, the following error message appears:

Run-time Error '1004': Unable to get the Object property of the OLEObject class.



CAUSE
This problem occurs when you do the following:
 * You insert a Microsoft Graph object in a worksheet.

-and-


 * You attempt to return a property of the Graph object in a macro.

This behavior is by design of Microsoft Graph and Microsoft Visual Basic for Applications.



WORKAROUND
Microsoft provides programming examples 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. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

Before you refer to the Microsoft Graph object application, activate the Graph object by using the Activate method of the object. For example, the following macro statement activates a Graph object that is embedded on Sheet1 of a workbook: Sheet1.OLEObjects(1).Activate



MORE INFORMATION
You can return the properties of an object in a Visual Basic for Applications macro by referring to the application for the object. For example, the following sample macro returns an embedded Microsoft Graph application name and object name: Sub GraphEx Sheet1.OLEObjects(1).Activate Set myApp.OLEObjects(1) MsgBox "Object name = " & myApp.Name MsgBox "Object application name = " & myApp.Object.Application.Name End Sub Note that a run-time error occurs if you attempt to refer to properties for an embedded object unless you open the object. The properties are unavailable to Visual Basic because the object is embedded and the server application is not active.

