Dış veri al da tanımlama hatası nerede?

Kemal Demir

Özel Üye
Katılım
29 Temmuz 2004
Mesajlar
2,108
Arkadaşlar iyi akşamlar.

Bazı Kelimeleri Türk Dil Kurumundan Bakmam Gerekiyor.
Bundan dolayı Excel Atarak Çalışmak istiyorum.

[vb:1:511ccdcba4]Sub disverial()
ad = InputBox("Aranılacak Kelimeyi Giriniz")

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.tdk.org.tr/TDKSOZLUK/sozbul.ASP?KELIME=ad&YENIARAMA=+++Ara+++" _
, Destination:=Range("A1"))
.Name = "sozbul.ASP?KELIME=kemal&YENIARAMA=+++Ara+++"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingRTF
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub[/vb:1:511ccdcba4]

Altın Çizili satırlardaki Tanımlama hatası var ki calısmıyor.Bu tanımlama hatasının nedenı ne olabilir.?

İyi Çalışmalar.
 
Katılım
16 Ağustos 2004
Mesajlar
137
Excel Vers. ve Dili
Office 2010 En 64 Bit
Merhaba,

Kodu aşağıdaki gibi değiştirirsen mesele hallolur.

Kod:
Sub disverial()
Dim ad As String
'
Cells.Select
Selection.Delete Shift:=xlUp
'
    ad = InputBox("Aranılacak Kelimeyi Giriniz")

     With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://www.tdk.org.tr/TDKSOZLUK/sozbul.ASP?KELIME=" & ad & "&YENIARAMA=+++Ara+++" _
        , Destination:=Range("A1"))
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = False
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlAllTables
        .WebFormatting = xlWebFormattingRTF
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .Refresh BackgroundQuery:=False
    End With
End Sub

Hatan; 'ad' değişkeni öncesinde tırnağı kapatıp '&' sembolü basıp sonrasında da yine '&' girip tırnağı açmaman.

Ayrıca ikinci defa sorgu yapacağında sayfada zaten mevcut bir sorgu bulunduğundan yine hata alacaktın, bunu aşmak için de kodun başına;

Kod:
Cells.Select
Selection.Delete Shift:=xlUp
satırlarını koydum.

Son olarak da her türlü aksiliğe karşı 'ad' değişkeninin 'string olduğunu belirttim.
 
Katılım
13 Temmuz 2005
Mesajlar
134
Excel Vers. ve Dili
ofis xp, 2003
Ben denedim calışıyor hocam.References bölümünde birşeyler işaretli olabilir kaldırıp bir dene.
sergions arkadaşın cevabı benim gözümden kacanları acıklamış.tşk
 

Kemal Demir

Özel Üye
Katılım
29 Temmuz 2004
Mesajlar
2,108
Bu sefer neden olmadı

Anlasılan Yine Kavrayamadım!

Verialma İşlemini Kavrayapı kavrayamadıgımı anlamak için başka bir veri alacagım yer belirledim.

Ama Sonuc Yine nafile :kafa:
[vb:1:cc16a7bb3d]
Sub verial()
Cells.Select
Selection.Delete Shift:=xlUp
Range("A1").Select
ifade = InputBox("ifade gir")
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.ingilizcesozluk.gen.tr/sozluk.php?word=ifade&", Destination:=Range("A1"))
.Name = "sozluk.php?word=kapı_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "5"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
[/vb:1:cc16a7bb3d]

Yine Olmadı Busefer neden
 
Katılım
17 Şubat 2006
Mesajlar
117
RAKKAS MERHABA, ÇÖZÜM AŞAĞIDA:
:hey:

Sub verial()
Cells.Select
Selection.Delete Shift:=xlUp
Range("A1").Select
ifade = InputBox("ifade gir")
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.ingilizcesozluk.gen.tr/sozluk.php?word=" & ifade, Destination:=Range("A1"))
.Name = "sozluk.php?word=" & ifade
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "5"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
 
Üst