nelsonwang
New Member
Hello, my excel file has a list of zip codes, and I am trying to look up these zip codes on FedEx website to determine the shipping zones, and then bring the results back to the excel file. I wrote following codes, using InternetExplorer.Application to connect to the FedEx webiste. I am able to auto populate the origin zone, destination zone fields, and figured out a way to click the "Find Zones" button, and get the zone value (in this case, zone=4). However, I am struggling how to write the code to bring the value (4) back to Excel. Any suggestion is appreciated.
Sub test()
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.navigate "http://www.fedex.com/ratetools/RateToolsMain.do?method=SetupFindZones"
Do While .Busy Or _
.readyState <> 4
DoEvents
Loop
Set origin = .document.getElementsByname("origPostalCd")
origin.Item(0).Value = "83716"
Set dest = .document.getElementsByname("destPostalCd")
dest.Item(0).Value = "95050"
.document.rateToolsMainForm.target = "_parent"
.document.rateToolsMainForm.method.Value = "FindZones"
.document.rateToolsMainForm.submit
End With
End Sub
Sub test()
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.navigate "http://www.fedex.com/ratetools/RateToolsMain.do?method=SetupFindZones"
Do While .Busy Or _
.readyState <> 4
DoEvents
Loop
Set origin = .document.getElementsByname("origPostalCd")
origin.Item(0).Value = "83716"
Set dest = .document.getElementsByname("destPostalCd")
dest.Item(0).Value = "95050"
.document.rateToolsMainForm.target = "_parent"
.document.rateToolsMainForm.method.Value = "FindZones"
.document.rateToolsMainForm.submit
End With
End Sub