Submitting w/o Submit button (Web)

Todd Bardoni

Well-known Member
Joined
Aug 29, 2002
Messages
3,042
I'm trying to query a webpage...

Excel enters the value into the field I want. To submit manually, I have to hit the Enter key since there is no command button on the webpage. How can I have Excel hit Enter automatically? Is this even clear?
 
Yeah, even if I could just get the source code then I could do somethig with that...

Just saw your porst Kristy...I'll take a look.
Whatever happened to Juan anyway?
 
Upvote 0
Kristy

I've seen and tried adapting that code before, and just tried it on Todd's page.

It didn't work previously and doesn't work now.

The code runs fine but nothing is pasted.

Does it work for you?

This is what I tried.
Code:
Sub WebQuery()
    Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
            .Navigate "http://www.xpresswayplus.com/webapp/magec/servlet/Production"
            Do Until .ReadyState = 4
                DoEvents
            Loop
            Set myTextField = .document.all.Item("txtPart")
            myTextField.Value = "1229G1619"
            ie.document.forms(0).submit
            Do Until .ReadyState = 4: DoEvents: Loop
            Do While .busy: DoEvents: Loop
            .ExecWB 17, 2
            .ExecWB 12, 2
            ActiveSheet.Paste Range("A1")
    End With
End Sub
 
Upvote 0
Todd

I can get the source code like this.
Code:
MsgBox ie.document.forms(0).innerHTML
You can also get the text like this.
Code:
MsgBox ie.document.forms(0).innerText
I tried putting the HTML in a cell hoping Excel might actually see it as HTML but no luck.
 
Upvote 0
Ya know, I tried copying the page manually and no luck. I wonder if they put code in there to prevent it from being copied?

Thanks, Norie, I'll try it...
 
Upvote 0
Norie, you're a genious! This will work just fine! Thanks.

But I'd still like to know why I can't copy the page. Turns out I can copy the table manually, but not not the entire page...
 
Upvote 0
Todd

I can copy the entire table.:huh:

I've started on parsing the code.
Code:
strProductTable = ie.document.forms(0).innerHTML
            
pos1 = InStrRev(strProductTable, "TABLE")
pos1 = InStrRev(strProductTable, "TABLE", pos1)
pos2 = InStrRev(strProductTable, "TABLE", pos1)
strProductTable = Mid(strProductTable, pos2 - 1, pos1 - pos2 + 7)
This isolates the HTML code for the table.

I'm not 100% sure how to proceed from here, I'm going to look into the Split function,
or whether this would work with other tables.
 
Upvote 0
Norie, I will leave this up to you because it is very simple to extract the data I need from

MsgBox ie.document.forms(0).innerText

So, if you'd like to increase all of our knowledge then please proceed, but as for the task at hand, I think we're all set.
 
Upvote 0
Todd

I probably will continue with it but with less emphasis as it's just a 'simple' parsing exercise now.

I've found it quite interesting looking into this, especially the HTML object stuff. :o

I'm kinda disappointed that there I can't seem to find anything in there where you could simply grab the table/data. :cry:

If I ever get a working solution I'll post back.:)
 
Upvote 0

Forum statistics

Threads
1,226,834
Messages
6,193,216
Members
453,779
Latest member
C_Rules

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