Microsoft KB Archive/71315

= XL97: Run-time Error Using Location Method to Change Chart =

Article ID: 71315

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q71315





SYMPTOMS
When you use the Location method in a Visual Basic for Applications macro to change the location of a chart, you may receive the following error message:

Run-time error '438'

Object doesn't support this property or method.



CAUSE
This problem occurs if the following conditions are true:


 * You have attached Visual Basic code to the SheetActivate event of the ThisWorkbook object. -and-


 * You use the FileFormat property in the SheetActivate macro.



RESOLUTION
To correct this problem, obtain Microsoft Excel 97 Service Release 2 (SR-2).

For additional information about SR-2, please see the following article in the Microsoft Knowledge Base:

151261 OFF97: How to Obtain and Install MS Office 97 SR-2



STATUS
Microsoft has confirmed this to be a problem in Microsoft Excel 97.

This problem was corrected in Microsoft Office 97 Service Release 2 (SR-2).



Example of the Problem
The following steps illustrate how to reproduce the problem:

 Type the following values into a new workbook:

A1: 1

A2: 2

 Select cells A1:A2, and then click Chart on the Insert menu. Click Finish in the Chart Wizard dialog box.

A column chart is created on Sheet1. Start the Visual Basic Editor (press ALT+F11). On the View menu, click Project Explorer. Double-click the ThisWorkbook object.</li>  Type the following code for the SheetActivate event into the module sheet: Private Sub Workbook_SheetActivate(ByVal Sh As Object)

y = ThisWorkbook.FileFormat

End Sub </li> Click Module on the Insert menu.</li>  Type the following code into the module sheet: Sub Relocate_Chart

Dim sName As String Dim x As Integer

Set ch = Sheet1.ChartObjects(1).Chart sName = Sheet1.Name

For x = 1 To 2 Set ch = ch.Location(xlLocationAsNewSheet) Set ch = ch.Location(xlLocationAsObject, sName) Next

End Sub </li> Run the Relocate_Chart procedure.

You receive the run-time error described in the &quot;Symptoms&quot; section of this article.</li></ol>

Additional query words: Run-time error 438 Object doesn t support this property or method

Keywords: kbbug kberrmsg kbfix kbqfe KB71315

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.