Microsoft KB Archive/225189

= OFF2000: Error Running Range Property Example for Office Spreadsheet =

Article ID: 225189

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Office Spreadsheet Component 9.0, run time

-



This article was previously published under Q225189



SYMPTOMS
In Microsoft Visual Basic Help, the Range property gives the following incorrect examples for the Office Spreadsheet component: Spreadsheet1.Range("A1:A10").RowHeight = 15 -and- Set curRegion = Spreadsheet1.Range("a1").CurrentRegion Set tempRange = curRegion.Range(curRegion.Cells(2, 3), _   curRegion.Cells(curRegion.Rows.Count, 4)) Running either of these examples will return the following error:

Run-time error '451':

Property let procedure not defined and property get procedure did not return an object.



RESOLUTION
The correct use of the Range property with the Office Spreadsheet component is using the Range property with either the ActiveSheet or Cells property.

ActiveSheet Property Example
Spreadsheet1.ActiveSheet.Range("a1:a10").RowHeight = 15

Set curRegion = Spreadsheet1.ActiveSheet.Range("a1").CurrentRegion Set tempRange = curRegion.Range(curRegion.Cells(2, 3), _   curRegion.Cells(curRegion.Rows.Count, 4))

Cells Property Example
Spreadsheet1.Cells.Range("a1:a10").RowHeight = 15

Set curRegion = Spreadsheet1.Cells.Range("a1").CurrentRegion Set tempRange = curRegion.Range(curRegion.Cells(2, 3), _      curRegion.Cells(curRegion.Rows.Count, 4))



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words: OFF2000 runtime error

Keywords: kbbug kbdocerr kberrmsg kbprogramming kbweb KB225189

-

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

© Microsoft Corporation. All rights reserved.