shanp
Dec 27th, 2000, 08:29 AM
How to enter values in createnew ole control.
I don’t want by ole automation
I placed an ole in my form1 and I selected the excel sheet from createnew option button.
By default my form contains 11 columns.In the same form under the excel sheet I placed a 2 textboxes.
My doubt is I want to enter the values in my form1 excel sheet through textbox.
But my code is creating new excel sheet.
Code.
Commandclick event
Dim xlApp As Object
Dim xlbook As Workbook
Dim xlsheet As Worksheet
Set xlApp = New Excel.Application
Set xlbook = xlApp.Workbooks.Add
Set xlsheet = xlbook.Worksheets.Add
xlsheet.Cells(1, 1) = text1.text
xlsheet.cells(2,1)=text2.text
I don’t want by ole automation
I placed an ole in my form1 and I selected the excel sheet from createnew option button.
By default my form contains 11 columns.In the same form under the excel sheet I placed a 2 textboxes.
My doubt is I want to enter the values in my form1 excel sheet through textbox.
But my code is creating new excel sheet.
Code.
Commandclick event
Dim xlApp As Object
Dim xlbook As Workbook
Dim xlsheet As Worksheet
Set xlApp = New Excel.Application
Set xlbook = xlApp.Workbooks.Add
Set xlsheet = xlbook.Worksheets.Add
xlsheet.Cells(1, 1) = text1.text
xlsheet.cells(2,1)=text2.text