- Katılım
- 30 Mart 2008
- Mesajlar
- 280
- Excel Vers. ve Dili
- Microsoft Office Excel 2003, Türkçe
Arkadaşlar aşağıdaki kodla kullanıcı adı ve parola ile giriş yapılan bir sayfaya kullanıcı adını ve parolayı kod vasıtasıyla excel üzerinden giriş yaptırarak açabiliyordum. Ama işletim sistemim xp'den windows 7'ye ve explorer sürümüm de 8'den 9'a yükseltilince malesef aynı kodun kırmızı renkle işaretlediğim bölümünde hata vermeye başladı. Konuyla ilgili yardımcı olursanız sevinirim...
Kod:
Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Dim IE As Object 'İnternet Explorer için değişken tanımı
'**********************
Sub Mly()
On Error GoTo ErrHandler:
Dim IE As Object
Dim HTML_Body As Object
Dim HTML_Tables As Object, MyTable As Object, HTML_Input As Object
URL = "http://uyg.xyz.com/PktMly2008/Giris/"
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate URL
[COLOR="Red"]Do Until IE.readyState = 4: DoEvents: Loop
Do While IE.Busy: DoEvents: Loop[/COLOR]
[COLOR="Red"]Set HTML_Body = IE.document.getElementsByTagName("Body").Item(0)
Set HTML_Tables = HTML_Body.getElementsByTagName("Table")
Set MyTable = HTML_Tables(1)[/COLOR]
On Error GoTo ErrHandler:
HTML_Body.all.txtKln.Value = "12345678910"
HTML_Body.all.txtParola.Value = "Ankara03-"
Set HTML_Input = HTML_Body.getElementsByTagName("Input")
Set MyButton = HTML_Input(6)
MyButton.Click
IE.Visible = True
apiShowWindow IE.hwnd, SW_MAXIMIZE 'Pencereyi Maximize yap
GoTo SafeExit:
ErrHandler:
MsgBox "Bağlantı hızınız yetersiz veya siteye zaten login durumdasınız." _
& vbCrLf & "Başka bir neden de;" & vbCrLf & Err.Description, vbCritical, "Dikkat...!"
IE.Visible = True
SafeExit:
Set HTML_Body = Nothing
Set HTML_Tables = Nothing
Set MyTable = Nothing
Set IE = Nothing
End Sub
Son düzenleme:
