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

Can you tell me the properties of the controls?

1716


What is the use of debug Window?

1715


How can you check whether a record is valid record or Invalid record using ADO control or Object?

1561


___,___ and __ are difference between image and picture controls.

1253


How would you attach an ActiveX control in Your Application?

1754






___ property used to add a menus at runtime.

1415


What are the different procedures associated with the object?

744


which method used to move a recordset pointer in nth position in DAG?

1707


What is the default model of the form?

1777


What language does visual basic use?

658


What do you mean by Databound Controls Explain?

1588


Is it possible to set a shortcut key for label?

1539


What is OLEDB?

1700


State about the different types of visual basic data?

706


What is DBSqlPassThrough?

2877