+ Reply to Thread
Results 1 to 3 of 3

link to a DHL tracking site

  1. #1
    cbrah
    Guest

    link to a DHL tracking site

    I need to create a link that will take a airbill tracking number I have
    listed in column "C3" and when clicked, go to the status screen of the DHL
    tracking website.
    This is the site:
    http://track.dhl-usa.com/TrackByNbr.asp
    This is an example of a tracking number 38821115060
    When I create the link I wind up at the home page, not the tracked info page.
    Any suggestions would get me out of hot water.

  2. #2
    Tim Williams
    Guest

    Re: link to a DHL tracking site

    Try this. Place a button on the sheet and link it to GetTrackingInfo.
    Select a cell with a tracking number and click the button.


    'add references to
    ' Microsoft Internet Controls
    ' Microsoft HTML Object Library

    Sub GetTrackingInfo()


    Dim IEObj As Object

    Const S_URL As String = "http://track.dhl-usa.com/TrackByNbr.asp"
    Dim doc As MSHTML.HTMLDocument
    Dim s As String

    If trim(ActiveCell.Value) <> "" Then
    s = Trim(ActiveCell.Value)
    Else
    Exit Sub
    End If

    Set IEObj = GetIE()
    IEObj.Navigate S_URL
    Do While IEObj.ReadyState <> READYSTATE_COMPLETE
    Loop
    Set doc = IEObj.Document
    doc.frmTrackByNbr.txtTrackNbrs.Value = s
    doc.frmTrackByNbr.submit

    End Sub

    Function GetIE() As Object


    Dim objShell As Object, objShellWindows As Object, o As Object
    Dim retVal As Object, sURL As String


    Set retVal = Nothing
    Set objShell = CreateObject("Shell.Application")
    Set objShellWindows = objShell.Windows

    'see if IE is already open
    For Each o In objShellWindows
    sURL = ""
    On Error Resume Next
    sURL = o.Document.Location
    On Error GoTo 0
    If sURL <> "" Then
    Set retVal = o
    Exit For
    End If
    Next o

    If retVal Is Nothing Then
    Set retVal = New InternetExplorer
    retVal.Visible = True
    End If

    Set GetIE = retVal
    End Function

    "cbrah" <[email protected]> wrote in message
    news:[email protected]...
    >I need to create a link that will take a airbill tracking number I
    >have
    > listed in column "C3" and when clicked, go to the status screen of
    > the DHL
    > tracking website.
    > This is the site:
    > http://track.dhl-usa.com/TrackByNbr.asp
    > This is an example of a tracking number 38821115060
    > When I create the link I wind up at the home page, not the tracked
    > info page.
    > Any suggestions would get me out of hot water.




  3. #3
    Registered User
    Join Date
    03-08-2017
    Location
    Tamarac, FL
    MS-Off Ver
    2013
    Posts
    6

    Re: link to a DHL tracking site

    i realize this is an old posting but would like to learn how to do the same; i have linked the DHL tracking # but as above, it takes me to the DHL tracking page and not the specifics of the shipment # itself.
    above is a bit complicated and i am inexperienced in VBA so was hoping someone could walk me thru the above a bit more clearly and in a bit more detail OR if there is another way apart from this VBA method?

    thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1