Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have code that copies data from a website into excel. Since its a
login site, I can get a webquery to work correct. The following code works about 90% of the time but 10% of the time I get an "object variable or with block variable not set - runtime error 91" error on ipf.value=username line. Im not sure why i am getting this error. Any help would be appreciated. Dim username As String Dim password As String Dim ie as object Set ie = CreateObject("internetexplorer.application") With ie .Visible = True .Navigate "https://mywebsite" Do Until Not .busy DoEvents Loop username = ActiveSheet.Range("z1").Value Debug.Print username password = ActiveSheet.Range("z2").Value Debug.Print password Set ipf = ie.document.all.Item("s10_") ipf.Value = username <--------ERROR HERE Set ipf = ie.document.all.Item("s12_") ipf.Value = password Set ipf = ie.document.all.Item("s16_") ipf.Click Do Until Not .busy DoEvents Loop End With |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Looks as though for some reason there is no "ipf" input element in the
document. Try adding some error checking to catch this. Eg: Set ipf = ie.document.all.Item("s10_") If ipf is nothing then Msgbox "Input 's10_' not found!" Exit sub Else ipf.Value = username End If Tim wrote in message ups.com... I have code that copies data from a website into excel. Since its a login site, I can get a webquery to work correct. The following code works about 90% of the time but 10% of the time I get an "object variable or with block variable not set - runtime error 91" error on ipf.value=username line. Im not sure why i am getting this error. Any help would be appreciated. Dim username As String Dim password As String Dim ie as object Set ie = CreateObject("internetexplorer.application") With ie .Visible = True .Navigate "https://mywebsite" Do Until Not .busy DoEvents Loop username = ActiveSheet.Range("z1").Value Debug.Print username password = ActiveSheet.Range("z2").Value Debug.Print password Set ipf = ie.document.all.Item("s10_") ipf.Value = username <--------ERROR HERE Set ipf = ie.document.all.Item("s12_") ipf.Value = password Set ipf = ie.document.all.Item("s16_") ipf.Click Do Until Not .busy DoEvents Loop End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A spreadsheet template for website login details | Excel Discussion (Misc queries) | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Interior class error/runtime error 1004 | Excel Programming | |||
Making a auto website login script | Excel Programming | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |