View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Why Spreadsheet worksheet is not a worksheet?

Try -

dim Sht As OWC.Spreadsheet
dim Dim Wksht As OWC.Worksheet

Set Sht = Me.Controls.Add("OWC10.Spreadsheet.10")


(might be easier to add at design time, at least for testing)

set Wksht = Sht.activesheet

The control has just the single sheet

Put a break and look at Sht and Wksht in Locals or look at OWC in object
browser.

Regards,
Peter T

"Bula" wrote in message
oups.com...
Appreciate very much if you can help.
I add a Spreadsheet control on my userform, and want to reference a
worksheet on the control. But got a "Type mismatch" error.


Set Sht = Me.Controls.Add("OWC10.Spreadsheet.10")

Dim Wksht As Worksheet
Set Wksht =Sht. Worksheets("Sheet1")

Why the worksheet on the Spreadsheet control is not of type worksheet?


George