Excel Vba'dan Google E tablo'ya (Apps komut dosyasına) çevirme

Mahmut1976

Altın Üye
Katılım
22 Temmuz 2019
Mesajlar
32
Excel Vers. ve Dili
Ofis7
Altın Üyelik Bitiş Tarihi
11-03-2025
Merhaba sayin hocalarim Excelden bir programim var. Google E tabloya gecmek istiyorum. Excel Vba dan Google E tablo koduna (java sprinte) cevirmek istiyorum yardimci olabilecek hocam var mi?

Sub mebseans2()
On Error Resume Next
Dim meb As New WebDriver
Dim TC As List

meb.Start "chrome"
meb.Wait 1000
meb.Window.Maximize 'ekranı kaplama
meb.Get "https://mebbis.meb.gov.tr/default.aspx"

meb.FindElementById("txtKullaniciAd").SendKeys (ThisWorkbook.Sheets("veri").Range("A2").Value) ' excel adresini
meb.FindElementById("txtSifre").SendKeys (ThisWorkbook.Sheets("veri").Range("b2").Value)

meb.FindElementById("btnGiris").Click

meb.FindElementByXPath("//*[@id='ModulMenu1_TB_AnaMenu']/tbody/tr[3]/td/table/tbody/tr/td/table/tbody/tr/td").Click 'engelli birey münüsüne tıklar.

For X = 3 To ThisWorkbook.Sheets("AL").Cells(Rows.Count, "A").End(xlUp).Row 'a sutunundaki son hücreyi bulur
meb.Get "https://mebbis.meb.gov.tr/EOM/eom13010.aspx"
meb.FindElementById("ddlKurumOgrenci").SendKeys ThisWorkbook.Sheets("AL").Range("A" & X).Value 'ÖĞRENCİYİ TC İLE ARAR
meb.FindElementById("btnTcAra").Click

If ThisWorkbook.Sheets("AL").Range("B" & X).Value = "NORMAL" Then 'NORMAL YADA TELEFİYİ SECER
meb.FindElementByXPath("//*[@id='dgListele']/tbody/tr[2]/td[1]/input").Click
ElseIf ThisWorkbook.Sheets("AL").Range("B" & X).Value = "TELAFİ" Then
meb.FindElementByXPath("//*[@id='dgListele']/tbody/tr[2]/td[2]/input").Click
End If

meb.FindElementById("cmbAltProgram").SendKeys ThisWorkbook.Sheets("AL").Range("C" & X).Value 'programı secer
meb.FindElementById("cmbModulAdi").SendKeys Split(ThisWorkbook.Sheets("AL").Range("D" & X).Value, "/")(0) 'molulü secer
meb.FindElementById("cmbBolumAdi").SendKeys Split(ThisWorkbook.Sheets("AL").Range("D" & X).Value, "/")(1) 'bölümü secer

'Hedef Eklemek için
Set hedefler = meb.FindElementById("chkHedefAdi").FindElementsByTag("tr")
hedefsay = hedefler.Count
For hedef = 1 To hedefsay
If hedefler(hedef).Text = ThisWorkbook.Sheets("AL").Range("F" & X).Value Then
hedefler(hedef).FindElementByTag("td").FindElementByTag("input").Click
Exit For
End If
Next hedef

'Davranış Eklemek için
Set davranislar = meb.FindElementById("chkHedefDavranisAdi").FindElementsByTag("tr")
davranissay = davranislar.Count
For davranis = 1 To davranissay
Set davranislar = meb.FindElementById("chkHedefDavranisAdi").FindElementsByTag("tr")
davranislar(davranis).FindElementByTag("td").FindElementByTag("input").Click
meb.Wait 500
Next davranis

meb.FindElementById("cmbEgitimTuru").SendKeys ThisWorkbook.Sheets("AL").Range("H" & X).Value 'eğitim türünü secer
meb.FindElementById("cmbEgitimOda").SendKeys ThisWorkbook.Sheets("AL").Range("I" & X).Value 'eğitim odasınıı secer
meb.FindElementById("cmbEgitimSaati").SendKeys ThisWorkbook.Sheets("AL").Range("K" & X).Value 'Saat
meb.FindElementById("cmbEgitimSaatiDakika").SendKeys ThisWorkbook.Sheets("AL").Range("L" & X).Value 'Dakika
'öğretmen secer
meb.FindElementById("cmbPersonelAdSoyad").Click
Set Optionlar = meb.FindElementById("cmbPersonelAdSoyad").FindElementsByTag("option")
OptionSay = Optionlar.Count

For optn = 1 To OptionSay
Debug.Print Optionlar(optn).Text
If InStr(Optionlar(optn).Text, ThisWorkbook.Sheets("AL").Range("M" & X).Value) > 0 Then
Optionlar(optn).Click
Exit For
End If
Next optn

'takvimi girişi
meb.FindElementById("Us_tarih1_btnTarihGoster").Click 'takvimi açar
ay = Split(ThisWorkbook.Sheets("AL").Range("J" & X).Value, ".")(1)
If CInt(ay) < Month(Date) Then
meb.FindElementByXPath("/html/body/div[3]/table/thead/tr[2]/td[2]").Click
ElseIf CInt(ay) = Month(Date) Then
meb.FindElementByXPath("/html/body/div[3]/table/thead/tr[2]/td[3]").Click
End If

meb.FindElementById("Us_tarih1_btnTarihGoster").Click 'takvimi açar
'Aynı ayda ise günü seçerek işlem yapar.
Set haftalar = meb.FindElementByClass("calendar").FindElementByTag("tbody").FindElementsByClass("daysrow")
haftasay = haftalar.Count
For i = 1 To haftasay
Set gunler = haftalar(i).FindElementsByClass("day")
gunsay = gunler.Count
For g = 1 To gunsay
If gunler(g).Attribute("class") <> "day wn" Then
gun = Split(ThisWorkbook.Sheets("AL").Range("J" & X).Value, ".")(0)
If Left(gun, 1) = "0" Then
gun = Mid(gun, 2, 1)
End If
If gunler(g).Text = gun Then
gunler(g).Click

Exit For
End If
End If
Next g
Next i
meb.FindElementById("IncToolbarActive1_kaydet_b").Click 'kaydet butonuna tıklar

Sonuc = meb.FindElementById("lblUyari").Text
Sheets("AL").Range("N" & X) = meb.FindElementById("lblSonuc").Text

Sonuc = meb.FindElementById("lblUyari").Text
Sheets("AL").Range("N" & X) = meb.FindElementById("lblUyari").Text

Next


Application.Wait (Now + TimeValue("00:00:08")) ' 8 sn bekleyecek
End Sub
 
Üst