Click here to Skip to main content
Rate this: bad
good
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$"
Data1.Refresh
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
alm.Data1.Recordset.Update
            alm.Data1.Refresh
 

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

1 solution

Rate this: bad
good
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 [^]
  Permalink  
Comments
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 365
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 210
3 Afzaal Ahmad Zeeshan 204
4 CPallini 185
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


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