PDA

Click to See Complete Forum and Search --> : access the active x in code-behind(vb)


periwinkle_84
Apr 26th, 2007, 02:23 AM
hi,

I made an activex control that opens an new excel document.
This control is an image.

Code for my activex control:

Private Sub image_GotFocus()
Dim oExcel As Excel.Application
Dim oWB As Excel.Workbook
Dim oWS As Excel.Worksheet

Set oExcel = New Excel.Application
oExcel.Visible = True ' <-- *** Optional ***

Set oWB = oExcel.Workbooks.Add
Set oWS = oWB.Worksheets("Sheet1")
End Sub



I added it in my web application through the object tag:


<OBJECT id="Open" Width="120px" Height="32px"classid="CLSID:460485C2-980B-45E5-8051-04A1EFBB18E4"></OBJECT>


Since this control is for opening an excel window only,
I wanted to add few more codes for populating the excel sheet with contents of a gridview.

But the problem is,I don't know how to use the embedded control in the object tag.

Any ideas?

Thanks!

Sheila