I am trying to automate the scraping of data from a particular website within an intranet. Step one of the code is simply getting VBA to Log on for me with my credentials.
I changed the url (and username/password accordingly), to see if it was the code or the website and the code logs me in just fine.
Also, the code displays the webpage for debugging purposes, and it seems as the username and password don't show up in the text boxes, but if I use my mouse to click on the username/password box, both boxes are filled in with my correct username and password as programmed in the code. When I run this macro i get the error "Run time error 438: Object doesn't support this property or method." The problem occurs in the highlighted portions below, Here is my code:
Sub GetData() Dim ieApp As InternetExplorer Dim ieDoc As Object Dim ieTable As Object Dim clip As DataObject 'create a new instance of ie Set ieApp = New InternetExplorer 'you don’t need this, but it’s good for debugging ieApp.Visible = True 'assume we’re not logged in and just go directly to the login page ieApp.navigate "XXXXXXXXX" Do While ieApp.Busy: DoEvents: Loop Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop Set ieDoc = ieApp.document 'fill in the login form – View Source from your browser to get the control names With ieDoc.forms(0) .UserId.Value = "XXXXXXX" .Password.Value = "XXXXXXX" .button End With Do While ieApp.Busy: DoEvents: Loop Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop ieApp.Quit Set ieApp = Nothing End Sub