Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#26847
Bom dia, estou logar em um site com login senha via VBA. O problema é que abre uma janela para digitar o login e senha, dei uma pesquisada mas não achei solução.

Sub FazerLoginSite()

Dim IE As Object

Set IE = CreateObject("InternetExplorer.application")

With IE
.Visible = True
.Navigate ("http://www.trademap.org/Index.aspx")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
.Document.All("ctl00_MenuControl_Label_Login").Click
.Document.getElementById("PageContent_Login1_UserName").Focus
.Document.getElementById("PageContent_Login1_UserName").Value = "LOGIN" 'ID DO LOGIN E LOGIN
.Document.getElementById("PageContent_Login1_Password").Focus
.Document.getElementById("PageContent_Login1_Password").Value = "SENHA" 'ID DA SENHA E SENHA
.Document.All("PageContent_Login1_Button").Click 'Id confirmar
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
Debug.Print .LocationURL
End With
End Sub
Att
#27045
O código abaixo deu certo, créditos para Bernardo (Whattsapp):
Public Sub AbreIE()
Dim objIE As InternetExplorer
Dim Email As Variant
Dim Senha As Variant
Dim Link As String
On Error Resume Next

'##### - Insere aqui o email e senha - #####
Email = "xxx@gmail.com.br"
Senha = "123456"
'##### - Insere aqui o email e senha - #####


'Cria o Objeto Internet Explorer
DoEvents
Set objIE = CreateObject("InternetExplorer.Application")

'Indica a página a ser carregada
objIE.Navigate "http://trademap.org/"

Call Temporizador(objIE, 0)

With objIE.Document
'Abre o menu de Login e rastreia o link do Frame do Login
Do While Right(Link, 14) <> "anonymous=true"
.getElementById("ctl00_MenuControl_Label_Login").Click
Call Temporizador(objIE, 2)
Link = .getElementById("iframe_login").src
DoEvents
Loop

'Acessa individualmente a página do Frame do Login
Call Temporizador(objIE, 2)
objIE.Navigate Link
Call Temporizador(objIE, 2)

'Preenche os campos de login e senha
.getElementById("PageContent_Login1_UserName").innerText = Email
.getElementById("PageContent_Login1_Password").innerText = Senha

'Efetua o login e exibe a tela
.all.Item("PageContent_Login1_Button").Click
Call Temporizador(objIE, 1)
objIE.Visible = True
End With

'Limpa a memória
Set objIE = Nothing

'Mensagem de finalização
MsgBox "Procedimento efetuado com sucesso!"

End Sub

Public Sub Temporizador(ByVal objIE As InternetExplorer, ByVal sec As String)
Application.Wait (Now + TimeValue("0:00:0" & sec))

Do While objIE.Busy Or objIE.ReadyState <> 4
DoEvents
Loop
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord