• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

web ten gridden veri alma

  • Konbuyu başlatan Konbuyu başlatan Orion1
  • Başlangıç tarihi Başlangıç tarihi

Orion1

Uzman
Uzman
Katılım
1 Mart 2005
Mesajlar
22,239
Excel Vers. ve Dili
Win7 Home Basic TR 64 Bit

Ofis-2010-TR 32 Bit
Web ten gridden veri alma konusunda yardımınıza ihtiyacım var.
Aaşağıdaki linkte yazdığım kod ile veriyi alamadım.
Önce set etmek istedim ama o satırda hata verdi.
x i variant olarak tanımladım.
TypeMismacth hatası verdi.

Link:
http://betistuta.com/OAF.aspx

Bu satırda hata verdi.

Kod:
Set x = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_MainGrid")
 
Kodlar aşağıdadır.

Kod:
#If Win64 Then
Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
#Else
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
#End If
Kod:
Sub emekliweb59()
Dim URL As String
Dim i As Long
Dim ie As Object, t, l, chk_ulke, chk_tumu, chk_tkm, chk_lig
Dim x As Variant
'On Error Resume Next
Range("A:A").Clear
URL = "http://betistuta.com/OAF.aspx"
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Navigate URL
.Visible = 1
ShowWindow ie.hwnd, 6

Do Until ie.ReadyState = 4: DoEvents: Loop
Do While ie.Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("00:00:03"))
'veriler temizleniyor-------
Set chk_tkm = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_CHKTKM")
chk_tkm.Checked = False
Set chk_lig = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_CHKLIG")
chk_lig.Checked = False
Set chk_ulke = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_CHKULKE")
chk_ulke.Checked = False
Set chk_tumu = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_CHKTUMU")
chk_tumu.Checked = False
'----Veriler browser sayfasına yazılıyor--------
'chk_tkm.Checked = True
'chk_lig.Checked = True
'chk_ulke.Checked = True
chk_tumu.Checked = True
Set t = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_ListBox1")
Application.ScreenUpdating = False
On Error Resume Next
'Listbox listleniyor
For i = 0 To 1000
    Range("A" & i + 1).Value = t(i).Value
Next i
On Error GoTo 0
t.selectedIndex = 6
'Range("B4").Value = t.Rows(3).Cells(2).innerText
Set l = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_Button1")
l.Click
Set x = ie.Document.getElementbyid("ctl00_MainContentFull_MainContent_MainGrid")
Application.ScreenUpdating = True
End With
Application.Wait (Now + TimeValue("0:00:03"))

'ie.Quit:
Set ie = Nothing
MsgBox ("Bitti  ")
End Sub
 
Arkadaşlar kodlar olmuştur.
x set etmeden önce Busy yapmamız gerekiyormuş.
İlgilenen arkadaşlara teşekkür ederim.
 
Geri
Üst