okan32
Yeni Üye
- Katılım
- 29 Mar 2021
- Mesajlar
- 45
- Çözümler
- 3
- Aldığı beğeni
- 14
- Excel V
- Office 2019 TR
Aşağıdaki kod ile ziraat katılım bankasından altın alış ve satış verilerini excele çekiyordum ama dünden bu tarafa hata veriyor. yardımlarınız için şimdiden çok teşekkürler.
Kod:
Sub AltinVeriAl()
'This will load a webpage in IE
Dim i As Long
Dim URL As String
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
'Create InternetExplorer Object
Worksheets("Sayfa1").Unprotect "2713233"
Range("H2") = Format(Now, "dd.mm.yyyy hh:mm")
Set IE = CreateObject("InternetExplorer.Application")
'Set IE.Visible = True to make IE visible, or False for IE to run in the background
IE.Visible = False
'Define URL
URL = "https://www.ziraatkatilim.com.tr/"
'Navigate to URL
IE.Navigate URL
' Statusbar let's user know website is loading
Application.StatusBar = URL & " is loading. Please wait..."
' Wait while IE loading...
'IE ReadyState = 4 signifies the webpage has loaded (the first loop is set to avoid inadvertently skipping over the second loop)
Do While IE.ReadyState = 4: DoEvents: Loop 'Do While
Do Until IE.ReadyState = 4: DoEvents: Loop 'Do Until
'Webpage Loaded
Application.StatusBar = URL & " Loaded"
Application.Wait (Now + TimeValue("0:00:05"))
ActiveSheet.Range("r1") = IE.document.getelementbyid("piyasalar").innertext
'Unload IE
IE.Quit
Set IE = Nothing
Set objElement = Nothing
Set objCollection = Nothing
'MsgBox "Veriler çekildi."
Range("G2").Value = Range("J2").Value
Range("G3").Value = Range("J3").Value
Range("G4").Value = Range("J4").Value
Range("G5").Value = Range("J5").Value
UserForm1.Show 'ana kod bloğuna geçerken bu satır aktif edilmeli
Worksheets("Sayfa1").Protect "2713233"
End Sub