Writing and Reading From Excel file by using vb.net

alvinblim

Well-known member
Joined
Jan 7, 2006
Messages
46
Location
malaysia
Programming Experience
3-5
moz-screenshot.jpg
Hi,
i have some problem with writing data and reading data from Excel file. Do someone know how can i write the data into excel file and reading the data from excel file. i hope someone can provide more detail on excel file programming, because i dont hv experience on excel programming. i will appreciate for your reply.
Thank you very much

Best Regards,
Alvin
 
To open and read an excel file, you can use the following. I'm assuming you have added a reference to MS Excel 10.0 Library

VB.NET:
Dim xlsApp As Excel.Application
Dim xlsWB As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim xlsCell As Excel.Range
Dim xlsDatei As String

xlsApp = New Excel.Application
xlsApp.Visible = True
xlsWB = xlsApp.Workbooks.Open(Path)
xlsSheet = xlsWB.Worksheets(1)
xlsCell = xlsSheet.Range("A1")

Be sure to properly dispose of the objects after you have finished using them.
 
Back
Top