[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Web pages that use input from user.

Posted on 2005-04-06
5
Medium Priority
?
237 Views
Last Modified: 2010-05-02
I have written a program that keeps track of tracking numbers for several different trucking lines. What I would like to do is be able to highlight a tracking number and let the user click a button to track that shipment online. I have all of that working but many of the web sites show addresses like this:

http://www.myyellow.com/dynamic/services/servlet

I have 2 trucking lines web sites that work because the address to their web page shows the tracking number right in the address so all I have done is open internet explorer and tell it to go to that web page but I put whatever tracking number I want in there.

So my question is, is there a way to pass the tracking number to a web site like the one above? Do they maybe use an address that has the tracking number imbedded in it but is hidden that I could find? Thanks for any help.

J_K_M_A_N
0
Comment
Question by:J_K_M_A_N
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
edwardiii earned 500 total points
ID: 13721247
Hi, J_K_M_A_N.

I've set up a routine that grabs an open IE window, populates various Text input fields in the Web page with values, and clicks the "Submit" button on that page.  Getting the names of the textboxes is the key; you can do it by setting a textbox equal to the following type code and cycling through all possible values, or you can do a "View Source" of the target Web page and grab the pertinent "name=" values:

Text1.Text = "Name is: " & internetExplorerWin.Application.Document.Forms(2).Elements("tracknum").Name _
    & " Value is: " & internetExplorerWin.Application.Document.Forms(2).Elements(3).Value

To do what you want to do, tell IE to go to such a page (I wasn't able to use your Yellow Freight page because I didn't have time to set up a user account--the example below deals with the UPS tracking page at http://www.ups.com/content/us/en/index.jsx).  Then run the following code once the IE window has been opened:

    Dim objInternetExplorerShellWindows As Object
    Dim internetExplorerWin As Object
    Dim strBrowserCaption As String
 
    strBrowserCaption = "Welcome to UPS"
     
    Set objInternetExplorerShell = CreateObject("Shell.Application")
    Set objInternetExplorerShellWindows = objInternetExplorerShell.Windows
 
     For Each internetExplorerWin In objInternetExplorerShellWindows
          On Error Resume Next
         
          If internetExplorerWin.Application.Document.Title = strBrowserCaption Then
               
               internetExplorerWin.Application.Document.Forms(2).Elements(3).Value = "111111Test"
               internetExplorerWin.Application.Document.Form(2).Elements(4).Click
               internetExplorerWin.Application.Document.Forms(2).Submit
               
                Text1.Text = "Name is: " & internetExplorerWin.Application.Document.Forms(2).Elements("tracknum").Name _
                & " Value is: " & internetExplorerWin.Application.Document.Forms(2).Elements(3).Value
               
          End If
         
          If Err Then
              Err.Clear
          End If
 
     Next
 
     Set internetExplorerWin = Nothing
     Set objInternetExplorerShellWindows = Nothing
     Set objInternetExplorerShell = Nothing
0
 
LVL 3

Author Comment

by:J_K_M_A_N
ID: 13722972
OK. I am a little lost. I think I understand what you are doing but you said to find out what the name value is. I don't see where you use that. I believe I have the name value for the tracking number and the go button they use. (BTW, you don't need to sign up for an account. It is at the top of every page on their site.) I believe the name is FBNUMBERS and the name of the button is I4. How would I go about using that. Also, I would like to just open an internet explorer window to their home page and fill in the info and click go. Can I do the first part before it is visible? I am thinking I would just load the page fill in the info and click go THEN give the visible=true command. Would that work?

Thanks for the help. I think we are on the right track. :)

J_K_M_A_N


0
 
LVL 3

Author Comment

by:J_K_M_A_N
ID: 13723239
OK. After much messing around, I think I have it. I had to set forms(2) = forms(0) and then I set Elements("FBNUMBERS") and it works. I also figured out how to tell it what form to use. Thanks again for the help. I am giving you the points.


J_K_M_A_N
0
 
LVL 10

Expert Comment

by:edwardiii
ID: 13726298
Sorry for not getting back to you earlier, J_K_M_A_N.  Am at UC Irvine until late on Wednesdays.  Glad the code helped:)
0
 
LVL 3

Author Comment

by:J_K_M_A_N
ID: 13765957
Well EdwardIII, I hope you are still getting e-mail about this thread because I have a question for you. This is the code I am using that has worked for a few other sites but not on one or two of them. Can you look at it and see if I have something wrong? Thanks.


Dim IEo As InternetExplorer
Dim IEWin As Object
Dim IEShell As Object

Set IEo = CreateObject("InternetExplorer.Application")
IEo.Navigate2 "http://www.speedeedelivery.com/pod.html"

Do While IEo.ReadyState <> READYSTATE_COMPLETE
    DoEvents
Loop
IEo.Visible = True

Set IEShell = CreateObject("Shell.Application")
Set IEShell = IEShell.Windows

For Each IEWin In IEShell
    On Error Resume Next
   
    If IEWin.Application.Document.Title = "Spee-Dee Delivery - Proof of Delivery" Then
        IEWin.Application.Document.Forms("login_form").Elements("shipperno").Value = "Shipper No"
        IEWin.Application.Document.Forms("login_form").Elements("login_password").Value = "password"
        IEWin.Application.Document.Forms("login_form").Submit

    End If
   
    If Err Then
        Err.Clear
    End If
Next

Set IEo = Nothing
Set IEWin = Nothing
Set IEShell = Nothing


It opens the site but doesn't fill anything in and doesn't submit the form. Any ideas?

Thanks..
J_K_M_A_N
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question