0
Hello,
I’m trying to make a macro with VBA to automate a process in the company I work in. For this the macro should open the IE and enter the website of the company portal.
Follow the code written inside a Module:
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Sub Teste1()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
ie.Navigate ("https://portaldeacessos.visanet.corp/IDMProv/jsps/login/Login.jsp")
ie.Visible = True
ShowWindow ie.hwnd, 3
While ie.Busy
DoEvents
Wend
For Each l In ie.Document.GetElementsByID("user")
l.Value = "teste"
Next
End Sub
The problem is I can’t get her to interact with anything. Anything I try to do after entering the portal site gives the error "The 'Document' method of the 'Iwebbrowser2' object failed". But I know that this part below is correct because I’ve used in another macro that worked.
While ie.Busy
DoEvents
Wend
When I mark the FOR line to debug, I wait for the page to load and give F8, this other error occurs: "Automation error. The object was disconnected from its customers".
When I run the same program replacing the portal site with google, I can write in the Google search box without errors
My focus is on being able to resolve the "disconnected from your customers" error because it has been appearing more frequently. Does anyone know how to do?
Thank you
Turn off Protected mode inside the Security tab in Internet Explorer. Should be sufficient.
– Junior Moreira
I checked that the protected mode was already disabled. You happen to have some other solution?
– Murillo Carvalho