OFF2000: Error Running Range Property Example for Office Spreadsheet (225189)



The information in this article 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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kbdocerr kberrmsg kbProgramming kbweb KB225189