Click here to Skip to main content
13,097,012 members (81,083 online)
Rate this:
Please Sign up or sign in to vote.
Hai All,
I need to implement the function., ie., String data has been saved into Excel file.
Already i develop code for these operation in VB6 ..
But in VB.NET i don't know how to get it..
Please any body help me.
Here is my VB6 Code...
When form has been load
Data1.Connect = "Excel 8.0"
Data1.DatabaseName = CurDir & "\" & "data.xls"
Data1.RecordSource = "Sheet1$"
If Err <> 0 Then
    MsgBox "Select Excel File"
    Alarmcmd.Visible = False
End if

And this to write the data to the respective fields in Excel
alm.Data1.Recordset("ALARM") = "DG Low Fuel"

alm.Data1.Recordset("ALARM") = "Smoke/Fire"

alm.Data1.Recordset("DATE") = Mid(rxd, alarm_count, 2) & "/" & Mid(rxd, alarm_count + 2, 2) & "/" & Mid(rxd, alarm_count + 2 + 2, 2)

and this is to update and save the data in Excel

How i need to do the same task in VB.NET...........
Please help me.
Posted 1-Jan-12 20:00pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It's been ages since I've used VB6 so I'm unable to remember exactly what was the technique you have used. But with .Net, one way to modify an Excel file is to use Interop.

Few links for this topic (not in any order):
- How to automate Excel from Visual Basic .NET to fill or to obtain data in a range by using arrays[^]
- How to automate Microsoft Excel from Visual Basic .NET[^]
- Export to Excel using VB.Net[^]
- Microsoft.Office.Interop.Excel Namespace [^]
Espen Harlinn 2-Jan-12 19:04pm
Nice set of useful links, my 5
Mika Wendelius 3-Jan-12 0:25am
Thank you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 2 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100