Web Scrape VBA

tvman5683

Board Regular
Joined
Mar 23, 2009
Messages
94
Trying to run this code to work with an already open IE web page. I can step through the code with no errors but it never sends the data from the excel cells over to the web page. (it does find the correct open page my_title)
Any advice wold be greatly appreciated.



HTML:
Sub GetSofteon()
marker = 0Set objShell = CreateObject("Shell.Application")IE_count = objShell.Windows.CountFor x = 0 To (IE_count - 1)    On Error Resume Next    ' sometimes more web pages are counted than are open    my_url = objShell.Windows(x).******************    my_title = objShell.Windows(x).Document.Title
    If my_title Like "ScFlex" & "*" Then 'compare to find if the desired web page is already open        Set IE = objShell.Windows(x)        marker = 1        Exit For    Else    End IfNext
DoDoEvents
Loop Until IE.ReadyState = 4

IE.Document.All("txtFromDate").Value = ThisWorkbook.Sheets("sheet1").Range("c2")IE.Document.All("txtBldgID").Value = ThisWorkbook.Sheets("sheet1").Range("a2")IE.Document.All("txtsku").Value = ThisWorkbook.Sheets("sheet1").Range("b2")
IE.Document.GetElementByID("btnQuery").Click
MsgBox ("run complete")
End Sub
 
Still hoping someone can offer some advice??

Code:
Sub GetSofteon()

marker = 0
Set objShell = CreateObject("Shell.Application")
IE_count = objShell.Windows.Count
For x = 0 To (IE_count - 1)
    On Error Resume Next    ' sometimes more web pages are counted than are open
    my_url = objShell.Windows(x).******************
    my_title = objShell.Windows(x).document.Title


    If my_title Like "ScFlex" & "*" Then 'compare to find if the desired web page is already open
        Set IE = objShell.Windows(x)
        marker = 1
        Exit For
    Else
    End If
Next




Do
DoEvents


Loop Until IE.ReadyState = 4




IE.document.getElementByID("btnQuery").Click




MsgBox ("run complete")


End Sub

Also here is the html for the button I'm trying to click.

<LABEL for="btnQuery" title="Query">
<INPUT TYPE='BUTTON' id = "btnQuery" Value="Query"
title="Query" class="enablebtn"
*******="Javascript:queryClick();">
 
Upvote 0
<LABEL for="btnQuery" title="Query">
<INPUT TYPE='BUTTON' id = "btnQuery" Value="Query"
title="Query" class="enablebtn"
*******="Javascript:queryClick();">
 
Upvote 0
Code:
<LABEL for="btnQuery" title="Query">
                                                                <INPUT TYPE='BUTTON'  id = "btnQuery" Value="Query"
                                                                                             title="Query" class="enablebtn"
                                                                                             *******="Javascript:queryClick();">
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top