- Katılım
- 20 Aralık 2006
- Mesajlar
- 939
- Excel Vers. ve Dili
- türkçe
Kod:
Public DB As ADODB.Connection
Public RS As ADODB.Recordset
Public SQLStr As String
Sub DBON()
On Error Resume Next
Set DB = New ADODB.Connection
MyPath = Application.ThisWorkbook.Path & "\" & "1.XLS"
DB.Open "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" & MyPath
End Sub
Sub DBOFF()
On Error Resume Next
DB.Close
Set DB = Nothing
End Sub
Sub RSON()
On Error Resume Next
Set RS = New ADODB.Recordset
RS.CursorLocation = adUseClient
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
End Sub
Sub RSOFF()
On Error Resume Next
RS.Close
Set RS = Nothing
End Sub
Sub KayitBul()
On Error Resume Next
DBON
RSON
[a8:g1000].ClearContents
SQLStr = "SELECT [SIRA],[ADI],[SOYADI],[CINSI],[RENK], [NO] FROM [DATA$] "
RS.Open SQLStr, DB, 1, 3
Range("a8").CopyFromRecordset RS
[a1].Select
RSOFF
DBOFF
End Sub
ekteki dosyadan veri alamıyorum
bu konuda yardımcı olursanız sevinirim...
en azından hata nerde onu belirtirseniz çok makbule geçer