Click here to Skip to main content
15,941,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am facing one issue with HTML programming with VB 6.0. I have created one automate program to fill a web form on the internet with Visual Basic 6.0. For example observer below code.

Step 1: Create one Standard EXE project.

Step 2: Add reference to"Microsoft HTML Object Library" - You can add this from \windows\system32\mshtml.tlb

Step 3: Add reference to "Microsoft Internet Controls" - You can add this from \windows\system32\ieframe.dll

Step 4: Add one command button in form1.

Step 5: Open Internet explorer and verify that you have enabled the Java Script. To check that go to Tools menu --> Internet options->Security->Custom Level->Scripting.
Enable all the settings.

Copy and Paste Below code in form1.

Dim WithEvents HtmDOc As HTMLDocument

Private Sub Command1_Click()

Dim IE As SHDocVw.InternetExplorer
Set IE = Nothing
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ""
Do While IE.Busy
IE.Visible = True
Set HtmDOc = IE.document

End Sub

Private Function HtmDOc_onclick() As Boolean
HtmDOc_onclick = True
End Function

Now run the project and click on command button.
It will open an Internet explorer page and then will navigate to website.

Now IE will show you one message "Loading". Wait till search form appear. Once it gets load follow the below steps,

1. Select Abilene (ABI) from Departure City select box.
2. Select Acapulco (ACA) from Destination City select box.
3. Select any date as a Return Date.
4. Now click on the "SEARCH" button.

It will navigate you to page 404 Not found error page.

The problem which I am facing is that while going manually it is not showing me any error and its running smoothly.

Can anybody help me out in this issue?

If I am not setting its document object (in this case htmdoc), its working fine but I am not able to record anything.
Updated 21-Oct-10 19:54pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900