Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Needed with IE Form.Submit

Status
Not open for further replies.

Zacko

Technical User
Joined
Jan 22, 2005
Messages
7
Location
GB
Here's my piece of code and what is should do is this.

Basically what will happen is, an IE window will load and show a number to click. When you click the corresponding number, a message box will pop up and tell you what number you clicked (.value). When you click ok, the following command runs :-

HDoc.parentWindow.image_clickthrough_form.submit

And submits the form. The trouble is, I need it to submit the form with the number that you clicked, the .value which is returned, as at the moment I am submitting the form with no number and the page just reloads.

If you want to try it :-

Create a Form1
You need a Command1 button
You need a Text1 field

In References add , Microsoft Internet Control & Microsoft Http object Library

This is the code to paste in and test :-
--------------------------------------------------------------
Private WithEvents HDoc As HTMLDocument
Dim IE As New InternetExplorer
Private WithEvents IE2 As InternetExplorer

Private Sub Command1_Click()
Set IE2 = IE
IE.Visible = True
IE.navigate "End Sub

Private Sub IE2_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If UCase$(URL) = UCase(" Then
Set HDoc = IE.document
End If
End Sub

Private Sub HDoc_onmousedown()
Dim Elem As IHTMLElement
Set Elem = HDoc.parentWindow.event.srcElement
With Elem
If HDoc.parentWindow.event.button = 1 Then
Dim msg As String
Select Case UCase$(.tagName)
Case "INPUT"
MsgBox "You clicked on the " & .Value
Text1 = .Value
.Value = Text1
HDoc.parentWindow.image_clickthrough_form.submit

End Select

End If
End With
End Sub
-------------------------------------------------------


Many thanks for looking and help is greatly appreciated.

Zacko
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top