sesuai Judul om..
gimAna sih caRanya imPort exceL ke VB..??
tApi Langsung masuk ke DB access kitA..
aNe gA tAu gimana caRanya..
mohon pencerahAn yah teMan2 sekaLian..
mAkasih..

TeRRenJr wrote:sesuai Judul om..
gimAna sih caRanya imPort exceL ke VB..??
tApi Langsung masuk ke DB access kitA..
aNe gA tAu gimana caRanya..
mohon pencerahAn yah teMan2 sekaLian..
mAkasih..
Private CN As New ADODB.Connection
Private RS As New ADODB.Recordset
Private StrSQL As String
'Prosedure yang digunakan untuk melakukan koneksi ke database
Private Function Connect(DataPath As String, ByRef error As String) As Boolean
On Error GoTo err
Dim ConString As String
'ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataPath & ";Persist Security Info=False;"
ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataPath & ";Extended Properties=""Excel 8.0;HDR=YES;"";Persist Security Info=False"
If (CN.State = adStateOpen) Then
CN.Close
Set CN = New ADODB.Connection
End If
CN.Open ConString
CN.CursorLocation = adUseClient
Connect = True
Exit Function
err:
error = "Error Number : " & err.Number & vbCrLf & _
"Error Message : " & err.Description
Connect = False
End Function 'connect
Private Sub ReadFromFile(strFile As String)
Dim i As Integer
Dim err As String
If (Connect(strFile, err)) Then
RS.Open "select * from `Sheet1$`", CN, adOpenStatic, adLockOptimistic
RS.MoveFirst
While Not RS.EOF
Text1.Text = Text1.Text & RS.Fields(0).Value
For i = 1 To RS.Fields.Count - 1
Text1.Text = Text1.Text & " -> " & RS.Fields(i).Value
Next
Text1.Text = Text1.Text & vbCrLf
RS.MoveNext
Wend
Else
MsgBox error
End If
End Sub
Private Sub Form_Load()
ReadFromFile App.Path & "\file.xls"
End Sub

ekaperintis wrote:Didalam form1 tambahkan beberapa object :
1. ADODC1
2. TEXT1 (buat multiline=true)

TeRRenJr wrote:sesuai Judul om..
gimAna sih caRanya imPort exceL ke VB..??
tApi Langsung masuk ke DB access kitA..
aNe gA tAu gimana caRanya..
mohon pencerahAn yah teMan2 sekaLian..
mAkasih..


IbnuQoyyim wrote:TeRRenJr wrote:sesuai Judul om..
gimAna sih caRanya imPort exceL ke VB..??
tApi Langsung masuk ke DB access kitA..
aNe gA tAu gimana caRanya..
mohon pencerahAn yah teMan2 sekaLian..
mAkasih..
sepertinya udah di bahas deh oom... coba searching dl..
ngopi...





TeRRenJr wrote:tHread cLosed oM..
ProbLem soLved..

TeRRenJr wrote:tHread cLosed oM..
ProbLem soLved..


Users browsing this forum: No registered users and 7 guests