How do we call MS- Excel in VB?

Answer Posted / sugnaya

place two textbox and commandbuttons in design window
and copy this code in code window
-----------------------
Dim xl As New Excel.Application
Dim xlsheet As Excel.Worksheet
Dim xlwbook As New Excel.Workbook

Private Sub Command1_Click()
Text1.Text = xlsheet.Cells(2, 1)
Text2.Text = xlsheet.Cells(2, 2)
End Sub

Private Sub Command2_Click()
xlsheet.Cells(21, 1) = Text1.Text
xlsheet.Cells(21, 2) = Text2.Text
xlwbook.Save
End Sub

Private Sub Form_Load()
Set xlwbook = xl.Workbooks.Open("C:\Documents and
Settings\bct20vb\My Documents\sa.xls")
Set xlsheet = xlwbook.Sheets.Item(1)
End Sub

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of line styles available in Treeview Control?

1548


How do I create a new form in visual basic?

591


How about Access 2.0 compatibility?

1104


What are the tools in visual basic?

594


Recordset object consists what?

1671






What is ActiveX Dll and ActiveX Exe?

1737


What type of databases you can access through ADO Data Access Object?

1508


what are the Types of DBCombo boxes?

1772


What is instantiating?

1514


how to use unicode data in vb6 regarding to telugu language, my output is in only telugu language

3204


What are the Internet tools available in VB 6.0?

2489


Is the Access Engine and Visual Basic Pro good enough for database work?

1076


Clear property is available in ____,___ control.

1159


How would you navigate between one document to another document

1273


It is possible to access Text (x.txt) files? Explain.

1640