OFF2000: Error Running Range Property Example for Office Spreadsheet

ID: Q225189


The information in this article applies to:
  • Microsoft Office Spreadsheet Component 9.0, run time


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 pocedure 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 this to be a problem in the Microsoft products listed at the beginning of this article.

Additional query words: OFF2000 runtime error

Keywords : kbprg kbdocerr kbdta kbweb
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: May 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.