I tried to automate some logins and copy paste from the web onto my own machine. When I try the same thing from company's intranet I face problems. My error message is:
Object variable or With block variable not set.
Here is my code:
Sub getdata()
Dim IE As Object
Dim Doc As HTMLDocument
Dim naziv, test, test2 As Variant
'Set IE = CreateObject("InternetExplorer.Application")
Set IE = New InternetExplorerMedium
IE.Visible = True
IE.navigate "https://example.com/Pages/default.aspx"
Do While IE.readyState = 4
DoEvents
Loop
Set test = Doc
Set test2 = Doc
test2 = test.getElementById("testid")
MsgBox (test2.innerText)
End Sub