Aşağıdaki örnekte "dosya" değişkeni ile girdiğim zaman program hata veriyor
ama dosya yerine dosyanın adını yazarsan (örneğin nisan_2010.xls) program çalışıyor.
Neden kaynaklanabilir. office versiyonu 2003 ondan olabilirmi?
Sub mela()
Dim conn As Object, rs As Object
Dim baglan As Object
Set conn = CreateObject("AdoDb.Connection")
Set rs = CreateObject("AdoDb.Recordset")
dosya = ComboBox1.Value & ".xls"
yol = "\\10.90.1.239\K.B. Ortak\Kurumsal\ALP\"
conn.Open "Provider=microsoft.jet.oledb.4.0;data source=" & yol & "dosya;extended properties=""excel 8.0;hdr=yes"""
rs.Open "Select * from [sayfa2$] where vergi=" & CDbl(Range("A1").Value) & ";", conn, 1, 3
If rs.EOF = True Then
MsgBox "Tabloda kayıt yok."
Else: rs.movefirst
Range("B" & sat).CopyFromRecordset rs
End If
conn.Close
Set rs = Nothing
Set conn = Nothing
end sub
ama dosya yerine dosyanın adını yazarsan (örneğin nisan_2010.xls) program çalışıyor.
Neden kaynaklanabilir. office versiyonu 2003 ondan olabilirmi?
Sub mela()
Dim conn As Object, rs As Object
Dim baglan As Object
Set conn = CreateObject("AdoDb.Connection")
Set rs = CreateObject("AdoDb.Recordset")
dosya = ComboBox1.Value & ".xls"
yol = "\\10.90.1.239\K.B. Ortak\Kurumsal\ALP\"
conn.Open "Provider=microsoft.jet.oledb.4.0;data source=" & yol & "dosya;extended properties=""excel 8.0;hdr=yes"""
rs.Open "Select * from [sayfa2$] where vergi=" & CDbl(Range("A1").Value) & ";", conn, 1, 3
If rs.EOF = True Then
MsgBox "Tabloda kayıt yok."
Else: rs.movefirst
Range("B" & sat).CopyFromRecordset rs
End If
conn.Close
Set rs = Nothing
Set conn = Nothing
end sub
