Click here to Skip to main content
11,789,512 members (53,853 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB6 Excel string VB.NET
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 at 2-Jan-12 19:04pm
Nice set of useful links, my 5
Mika Wendelius at 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
0 OriginalGriff 954
1 Maciej Los 765
2 KrunalRohit 666
3 CPallini 606
4 Richard MacCutchan 420

Advertise | Privacy | Mobile
Web03 | 2.8.1509028.1 | Last Updated 2 Jan 2012
Copyright © CodeProject, 1999-2015
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