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

Write the Steps in Creating an ActiveX Control?

1966


What is meant by Establish Connection in RDO? 74.1s it possible to Access BackEnd procedures? Explain.

1084


What is FireHouse Cursors?

1756


what is the Difference between Dynaset and Snapshot?

1499


What is instantiating?

1611






what controls have you used in your project?

1471


How do I speed up control property access?

1006


How can you determine performance standards?

624


What is visual basic used for?

542


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

1457


Is it posible to Create Tables Through Querydef?

1662


How would you create properties in ActiveX Control?

1431


Why does everybody say I should save in TEXT not BINARY?

1138


Timer control contains ________ no. of events.

1736


How can you filter out specific type of file using file system controls?

1361