Sherwood
02-22-2007, 05:58 AM
Hi,
I am trying to use a spreadsheet on a User Form for the first time. I am trying to set the cell background colour but none of the methods I can use on 'regular' sheets will work. The spreadsheet is the Office Web Components V9 (although I am not using it for web data).
My User Form is called frmUI and the spreadsheet (V9) on the form is called shtUI
Here's my test Sub with three failed attempts to set the colour:
Sub TestRowColours()
frmUI.shtUI.Cells(2, 3).Interior.ColorIndex = 6 'YELLOW
'runtime error '438'
'Object doesn't support this property or method
frmUI.shtUI.[B3].Interior.ColorIndex = 6
'runtime error '438'
'Object doesn't support this property or method
frmUI.shtUI.Range("A1:Z1").Interior.ColorIndex = 6
'runtime error '451'
'property let procedure not defined and property get procedure
did not return an object
End Sub
Q1 What am I doing wrong?
Q2 Is there a source of info I should peruse before I try to do anything more with this sheet? (I'll be needing to copy, paste, hide rows and columns, protect, get cell values, etc.; all the usual stuff that is no problem with 'regular' sheets that aren't on a form).
Q3 Is there another object I should be using instead of the OWC spreadsheet?
Cheers,
Sherwood.
I am trying to use a spreadsheet on a User Form for the first time. I am trying to set the cell background colour but none of the methods I can use on 'regular' sheets will work. The spreadsheet is the Office Web Components V9 (although I am not using it for web data).
My User Form is called frmUI and the spreadsheet (V9) on the form is called shtUI
Here's my test Sub with three failed attempts to set the colour:
Sub TestRowColours()
frmUI.shtUI.Cells(2, 3).Interior.ColorIndex = 6 'YELLOW
'runtime error '438'
'Object doesn't support this property or method
frmUI.shtUI.[B3].Interior.ColorIndex = 6
'runtime error '438'
'Object doesn't support this property or method
frmUI.shtUI.Range("A1:Z1").Interior.ColorIndex = 6
'runtime error '451'
'property let procedure not defined and property get procedure
did not return an object
End Sub
Q1 What am I doing wrong?
Q2 Is there a source of info I should peruse before I try to do anything more with this sheet? (I'll be needing to copy, paste, hide rows and columns, protect, get cell values, etc.; all the usual stuff that is no problem with 'regular' sheets that aren't on a form).
Q3 Is there another object I should be using instead of the OWC spreadsheet?
Cheers,
Sherwood.