Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Help Needed with IE Form.Submit

Help Needed with IE Form.Submit

Help Needed with IE Form.Submit

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 :-


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 "http://www.kingsofchaos.com/recruit.php?uniqid=3268gpx4"
End Sub

Private Sub IE2_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If UCase$(URL) = UCase("http://www.kingsofchaos.com/recruit.php?uniqid=3268gpx4") 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

End Select

End If
End With
End Sub

Many thanks for looking and help is greatly appreciated.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close