VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get Data From Excel To Visual Basic.

by Rajender Sharma (7 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 20th November 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get Data From Excel To Visual Basic.

Rate Get Data From Excel To Visual Basic.



Dim db As Database
Dim rs As Recordset
Private filepath As String
Private sheetname As String

Private Sub Form_Activate()
DoEvents
filepath = "h:\CIVIL_RAJ\HOMES\vb_raj\test.xls"
sheetname = "Sheet1$"
Set db = OpenDatabase(filepath, False, False, "Excel 8.0;HDR=yes;")
Set rs = db.OpenRecordset(sheetname)
rs.MoveFirst
Screen.MousePointer = 11
While rs.EOF <> True
List1.AddItem rs.Fields("Name") & "  " & rs.Fields(1) & "  " & rs.Fields(2)
rs.MoveNext
Wend
Screen.MousePointer = 0
End Sub


Download this snippet    Add to My Saved Code

Get Data From Excel To Visual Basic. Comments

No comments have been posted about Get Data From Excel To Visual Basic.. Why not be the first to post a comment about Get Data From Excel To Visual Basic..

Post your comment

Subject:
Message:
0/1000 characters