Fedex Tracking Number - tracking

I need to integrate fedex api in my site. How can i get a new tracking number for the first time regarding a shipping. I couldnt find a method to get the tracking number? Please help, if anyone knows.
Thanks

I am guessing that you meant "create a FedEx shipment" when you refered to "new tracking number."
FedEx has a developer program in which you can sign up and integrate your website with FedEx. Once you sign up, you can:
Create shipments
Cancel shipments
Track packages
Schedule pickup
Create call tags
Etc.
The link for FedEx developer program is: http://www.fedex.com/us/developer.
Best!

The FedEx site for IE returns the webpage in an IFrame across another site. You can't cross sites for information with an Iframe. So instead do the following. You can transmit the following xml to: https://ws.fedex.com:443/web-services
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v10="http://fedex.com/ws/track/v10">
<soapenv:Header/>
<soapenv:Body>
<v10:TrackRequest>
<v10:WebAuthenticationDetail>
<v10:ParentCredential>
<v10:Key>productionkey</v10:Key>
<v10:Password>productionpassword</v10:Password>
</v10:ParentCredential>
<v10:UserCredential>
<v10:Key>productionkey</v10:Key>
<v10:Password>productionpassword</v10:Password>
</v10:UserCredential>
</v10:WebAuthenticationDetail>
<v10:ClientDetail>
<v10:AccountNumber>accountnumber</v10:AccountNumber>
<v10:MeterNumber>meternumber</v10:MeterNumber>
<v10:IntegratorId/>
<v10:Localization>
<v10:LanguageCode>EN</v10:LanguageCode>
<v10:LocaleCode>us</v10:LocaleCode>
</v10:Localization>
</v10:ClientDetail>
<v10:TransactionDetail>
<v10:CustomerTransactionId>Ground Track By Number</v10:CustomerTransactionId>
<v10:Localization>
<v10:LanguageCode>EN</v10:LanguageCode>
<v10:LocaleCode>us</v10:LocaleCode>
</v10:Localization>
</v10:TransactionDetail>
<v10:Version>
<v10:ServiceId>trck</v10:ServiceId>
<v10:Major>10</v10:Major>
<v10:Intermediate>0</v10:Intermediate>
<v10:Minor>0</v10:Minor>
</v10:Version>
<v10:SelectionDetails>
<v10:CarrierCode>FDXG</v10:CarrierCode>
<v10:PackageIdentifier>
<v10:Type>TRACKING_NUMBER_OR_DOORTAG</v10:Type>
<v10:Value>$WAYBILL$</v10:Value>
</v10:PackageIdentifier>
</v10:SelectionDetails>
<v10:ProcessingOptions>INCLUDE_DETAILED_SCANS</v10:ProcessingOptions>
</v10:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>
Use the following VBA Code to transmit and it will return the tracking info:
Public Function ReturnXMLResponse(ByVal XML_Method As Variant, _
ByVal XML_Track_URL As Variant, _
ByVal XML_Request As Variant, _
Optional ByVal WaybillNum As String = "", _
Optional ByVal CarrierName As String = "", _
Optional ByVal TotalWaybills As Long = 0, _
Optional ByVal XML_Chunks As Long = 1) As String
' Passed expressions to this function have to be Variant, as some arguments
' may be passed as Null which would result in a type conversion failure.
' If True Then Exit Function
ReturnXMLResponse = "Test" ' default if not supported or not tracked by request
If UCase(XML_Track_URL) <> "NOT SUPPORTED" And UCase(XML_Track_URL) <> "NOT TRACKED BY REQUEST" Then
If (WaybillNum <> "") And (CarrierName <> "") Then
TrackingCounter = TrackingCounter + (1 / XML_Chunks)
SBText = "Tracking: " & CarrierName & ":" & WaybillNum
If TotalWaybills <> 0 Then SBText = SBText & " (" & CLng(TrackingCounter) & "/" & TotalWaybills & ") [" & (TrackingCounter / TotalWaybills) * 100 & "%]"
SBText = SBText & "."
Application.SysCmd acSysCmdSetStatus, SBText
End If
Set XMLHTTP = CreateObject("Microsoft.xmlhttp")
If (WaybillNum <> "") And (CarrierName <> "") Then
SBText = SBText & "."
Application.SysCmd acSysCmdSetStatus, SBText
End If
XMLHTTP.Open XML_Method, XML_Track_URL, False
If (WaybillNum <> "") And (CarrierName <> "") Then
SBText = SBText & "."
Application.SysCmd acSysCmdSetStatus, SBText
End If
XMLHTTP.Send XML_Request ' okay to send blank string, if not needed
If (WaybillNum <> "") And (CarrierName <> "") Then
SBText = SBText & "."
Application.SysCmd acSysCmdSetStatus, SBText
End If
ReturnXMLResponse = Cstr(XMLHttp.ResponseText)
End If
If ReturnXMLResponse = "" Then ReturnXMLResponse = "Nothing"
End Function
Basically XMLHTTP.Send XML_Request
'XMLHTTP.Send = Sending the XML_Request which is the soap envelope
above. It 'then returns the valid XML.
shareeditdel

You can find all type of tracking numbers in the link below.
I tested some of them.
Response will not be exactly as it is written in dev guide, but It doesn't throw an error.
try another one and so on.
click this Link
Go to the page 2014: Appendix AA: Test Server Mock Tracking Numbers
You will see: page with tracking numbers. It worked for me.

Related

VBA using ahtCommonOpenFileSave with ahtOFN_ALLOWMULTISELECT, error when selecting single file

Maybe I'm overlooking the obvious, but I cant figure out how to deal with a single result in an array.
I'm using Ken Getz ahtCommonFileOpenSave API in VBA to enable selecting multiple files, using the following code.
Private Sub btn_openfiles_Click()
Dim strFilter As String
Dim strInputFileName As String
Dim strFiles() As String
Dim a As Long
strFilter = ahtAddFilterItem(strFilter, "Images (*.PNG)", "*.PNG")
strFiles = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=True, _
InitialDir:="T:\DTP\Programs\Default\", _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_EXPLORER + ahtOFN_ALLOWMULTISELECT)
If IsArray(strFiles) Then
For a = 0 To UBound(strFiles)
Me.test_filenames = Me.test_filenames & strFiles(a) & vbCrLf
Next a
Else
Me.test_filenames = strFiles
End If
End Sub
I know that the result is an array, because I'm setting the ahtOFN_ALLOWMULTISELECT flag. When multiple files are selected, this goes well. But if only one file is selected, an
error 13 is thrown (type mismatch on strFiles)
because the return value of ahtCommonFileOpenSave is not an array.
I may be able to force an Array type just by adding a dummy value to the array produced by ahtCommonFileOpenSave and disregard this when processing the file names in the form, but maybe there is a better solution. Anyone have a suggestion?
As I already mentioned, overlooking the obvious. Changing the variable type into variant did the trick . ahtComminFileOpenSave returns the complete array when multiple files are selected and is always a Variant type. Luuk's suggestion works too (a variant type is used by default when the variable type is omitted).
The corrected (and amended) code is like this and works like a charm!
Private Sub btn_openfiles_Click()
Dim strFilter As String
Dim strInputFileName As String
Dim varFiles As Variant
Dim a As Long
strFilter = ahtAddFilterItem(strFilter, "Images (*.PNG)", "*.PNG")
Me.test_filenames = ""
varFiles = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=True, _
InitialDir:="T:\DTP\Programs\Default\", _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_EXPLORER + ahtOFN_ALLOWMULTISELECT)
If IsArray(varFiles) Then
For a = 0 To UBound(varFiles)
Me.test_filenames = Me.test_filenames & varFiles(a) & vbCrLf
Next a
Else
Me.test_filenames = varFiles
End If
End Sub

Wrong output result from VBA code in Access tool

I am having some issue with a value that is being determined from some VBA code in my Access tool. I am quite a beginner with VBA and this code was developed alongside a very experienced VBA programmer (who has gone away hence is unable to assist me).
This is the code in question:
Private Sub ValidatePrinting()
Dim rst As DAO.Recordset, PrintMethodVal As Boolean, PracIdVal As Long, datePrintedcol As String, PrintedCount As Integer, ImportedCount As Integer
Dim fromtxt As String, wheretxt As String, conditionalImportedCount As Integer, PrintConditions As Boolean
PrintMethodVal = Me.filter_PrintMethod.Value
PracIdVal = Me.filter_PracticeID.Value
datePrintedcol = Me.filter_LetterRound.Value
datePrintedcol = IIf(datePrintedcol = "1st Round", "datePrinted_1st", IIf(datePrintedcol = "2nd Round", "datePrinted_2nd", ""))
PrintedCount = Me.filter_LetterCount.Value
PrintConditions = Me.filter_PrintConditions.Value
If (datePrintedcol = "") Then
Call DisplayMessage("All letters already sent")
Else
fromtxt = " tbl_main_ListLog as T INNER JOIN tbl_dbextract_GPPractice as GPP ON T.GPPracticeID = GPP.Id"
wheretxt = PrintSQLCriteria(PracIdVal, datePrintedcol)
Set rst = CurrentDb.OpenRecordset(PrintValidationSQL(PrintMethodVal, fromtxt, wheretxt))
ImportedCount = rst.Fields(0).Value
conditionalImportedCount = rst.Fields(1).Value
If ImportedCount = conditionalImportedCount Then
If ImportedCount = PrintedCount Then
If PrintMethodVal = PrintConditions Then
tb_Result = "All OK"
CurrentDb.Execute (" update " & fromtxt & " set " & datePrintedcol & " = date() " & wheretxt)
Else
tb_Result = "Wrong print method selected"
End If
Else
tb_Result = "Counts don't match"
End If
Else
tb_Result = "Mismatched print conditions"
End If
End If
End Sub
So the issue is, when the PrintMethodVal does not equal PrintConditions it outputs "Mismatched Print conditions" as opposed to the "Wrong print method selected" which is what it should. It also outputs "Mismatched Print conditions" when the ImportedCount also does not equal the PrintedCount (as well as the first situation), which is weird as the If should end there and output "Counts don't match".
This code was functioning correctly when originally developed, but I had to include the check for PrintMethodVal = PrintConditions.
What am I missing here?

Excel+VBA: Userfrom string Deal(Order) Number parsing

I am trying to make a full function report file which connects to old version access data base. I need to build a Userform where user can enter deal (order) number just like we can add pages in print dialog box.
So far I have found below question which has given me partial answer:
How to Parsing Full String and split into several String in Excel VBA?
I can use Split(string) method to get various deal numbers when separated by ",".
However, I also need From to TO deal number option as well.
so, if user enters on String1 = "10001 - 10050, 20111 , 20115"
then I need output as
Deal_Line.Deal_Number >= 10001 and Deal_Line.Deal_Number <= 10050
and Deal_Line.Deal_Number = 20111 and Deal_Line.Deal_Number = 20115.
I can refine SQL String for my requirement, I would like to know if there is a way to use two deliminator.
Expanding on #user3598756 answer, (which does exactly what you asked for) and interpreting your requirements I come up with the following:
Function ProcessString(strng1 As String, fieldname As String) As String
Dim sqlStrng As String
Dim strng As Variant, limits As Variant
For Each strng In Split(strng1, ",")
limits = Split(strng, "-")
If UBound(limits) = 0 Then
sqlStrng = sqlStrng & "[FIELD] = " & limits(0) & "|"
Else
sqlStrng = sqlStrng & "([FIELD] >= " & Trim(limits(0)) & " And [FIELD] <= " & Trim(limits(1)) & ")|"
End If
Next
ProcessString = Replace(WorksheetFunction.Trim(Join(Split(Left(sqlStrng, Len(sqlStrng) - 1), "|"), " Or ")), "[FIELD]", fieldname)
End Function
The test line would be:
MsgBox ProcessString("10001 - 10050, 20111 , 20115","Deal_Line.Deal_Number")
This will produce an output that I think is more likely to be what you actually want - using OR instead of AND for starters, adding in parentheses needed for the OR to work properly and allowing for multiple table/field names.
Then again, maybe I've misinterpreted your requirement - I just can't see what use having all AND would be one one field.
you could use this helper function:
Function ProcessString(strng1 As String) As String
Dim sqlStrng As String
Dim strng As Variant, limits As Variant
For Each strng In Split(strng1, ",")
limits = Split(strng, "-")
If UBound(limits) = 0 Then
sqlStrng = sqlStrng & "Deal_Line.Deal_Number = " & limits(0) & "|"
Else
sqlStrng = sqlStrng & "Deal_Line.Deal_Number >= " & limits(0) & " And Deal_Line.Deal_Number <= " & limits(1) & "|"
End If
Next
ProcessString = WorksheetFunction.Trim(Join(Split(Left(sqlStrng, Len(sqlStrng) - 1), "|"), " And "))
End Function
to be tested/expolited in your "main" code as:
Sub main()
MsgBox ProcessString("10001 - 10050, 20111 , 20115")
End Sub

VBA Function to connect to WHOIS server and return availability of a .com.au domain

I'm creating a template for a client who wishes to quickly check the availability of dozens of domains at a time. The template must remain as an excel file.
I've installed and used the SEOToolsForExcel which permitted me to query a server and check whether particular domains are available using the isdomainregistered() function. Unfortunately however, the function will always return 'true' (i.e. domain is taken) for all Australian ('.com.au') domains that are thrown at it. I've tried changing the TLD lookup in the xml config file as suggested in this page : http://seotoolsforexcel.com/how-to-setup-tlds-in-seotools-config-xml/
I tried with the following:
<Tld Name="au" WhoIsServer="whois.aunic.net" WhoIsNotFoundRegex="(no match)|(no data found)|(not found)|(no entries found)|(error for)|(invalid pattern)|(illegal question)" WhoIsCreatedRegex="" WhoIsUpdatedRegex="(?:Last Modified:\s*(\d{2}-[A-z]{3}-)\d{4})" WhoIsExpiresRegex="" WhoIsDelayMs="1000" />
and this one:
<Tld Name="au" WhoIsServer="whois-check.ausregistry.net.au" WhoIsNotFoundRegex="is free" WhoIsCreatedRegex="" WhoIsUpdatedRegex="" WhoIsExpiresRegex="" WhoIsDelayMs="1000" />
But neither seemed to have worked. I've checked with other services that clearly show that the domains are available, yet the SEOTool keeps returning false results (only on '.com.au' domains, '.com' domains work fine).
Thus, my next attempt is to code a custom function in excel to take the domain and send it through to the Ausregistry.com.au server's domain-availability tool.
Ausregistry explains how this can be done in their page here:http://www.ausregistry.com.au/tools/domain-availability
They explain:
The service will then respond with either the string 'Available' or 'Not Available' depending upon the availability of the Domain Name.
For Example
To check the availability of ausregistry.net.au follow these steps:
Connect to: Address: whois-check.ausregistry.net.au, Port: 43
Send the string `ausregistry.net.au\r\n' to the server
The server will respond with `Not Available' and then close the connection.
The above procedure is compatible with standard WHOIS protocol; hence any reseller interface that is built to use WHOIS will be able to use this system as well.
Alternatively, the standard *nix whois command can be used as follows:
whois -h
I've coded plenty in VBA before but I do not know how to implement this connection to the server and how to throw it the domain string and then read the result. I'd appreciate any information on how to achieve this using VBA.
Update. I solved this issue months ago and figured I would post my solution in case anyone stumbles across this. #Lumigraphics, thankfully I didn't have to learn PERL. I used the OstroSoft Winsock Component (you can get it here).
And the following UDF:
Function AusRegDomainAvailable(DomainUrl As String) As Boolean
Dim sPage As String
Dim sServer As String
Dim nPort As Long
Dim AusRegistryServer As String
Dim ReturningData As String
Dim wsTCP As OSWINSCK.Winsock
Dim FixedDomain As String
Dim Timelimit As Date
QueryTimeOut = False
FixedDomain = Replace(DomainUrl, "www.", "")
FixedDomain = Replace(FixedDomain, "http://", "")
FixedDomain = Replace(FixedDomain, "https://", "")
AusRegistryServer = "whois-check.ausregistry.net.au"
nPort = 43
sServer = Trim(AusRegistryServer)
If InStr(sServer, "://") > 0 Then sServer = Mid(sServer, InStr(sServer, "://") + 3)
If InStr(sServer, "/") > 0 Then
sPage = Mid(sServer, InStr(sServer, "/") + 1)
sServer = Left(sServer, InStr(sServer, "/") - 1)
End If
If InStr(sServer, ":") > 0 Then
nPort = Mid(sServer, InStr(sServer, ":") + 1)
sServer = Left(sServer, InStr(sServer, ":") - 1)
End If
If sServer = "" Then Err.Raise 12001, , "Invalid URL"
Set wsTCP = CreateObject("OSWINSCK.Winsock")
wsTCP.Connect sServer, nPort
Do Until wsTCP.State = 7
DoEvents
If wsTCP.State = sckError Then
Exit Function
End If
Loop
wsTCP.SendData FixedDomain & vbCrLf
Timelimit = (Now + TimeValue("0:00:02"))
Do Until wsTCP.Status = "Data Arrival" Or Now > Timelimit
DoEvents
If wsTCP.State = sckClosed Then
QueryTimeOut = True
Exit Function
End If
Loop
wsTCP.GetData ReturningData
ReturningData = Replace(ReturningData, vbLf, "")
ReturningData = Replace(ReturningData, vbCr, "")
ReturningData = Trim(ReturningData)
If ReturningData = "Available" Then
AusRegDomainAvailable = True
ElseIf ReturningData = "Not Available" Then
AusRegDomainAvailable = False
Else
QueryTimeOut = True
AusRegDomainAvailable = Null
End If
DoEvents
Debug.Print FixedDomain & " " & ReturningData
wsTCP.CloseWinsock
Exit Function
ErrHandler:
AusRegDomainAvailable = "Error " & Err.Number & ": " & Err.Description
End Function

Replace . to , in fetched currency amount of yahoo finance

I am using excel 2010.
I have the following vba function, which retrieves me currencies from yahoo finance. However, my problem is that I am using a German Version of Excel and the . is in this Version a ,.
Therefore the converted currencies look like that:
That is the function I am using:
Function MYCURRENCYEXCHANGER(SourceCur As String, DestCur As String) As Variant
Dim url As String
' http://quote.yahoo.com/d/quotes.csv?s=XXXYYY=X&f=l1 this is the link format where XXX is currency1 and YYY is currency2 '
url = "http://quote.yahoo.com/d/quotes.csv?s=" & SourceCur & DestCur & "=X&f=l1"
Dim myHTTP As New WinHttp.WinHttpRequest
myHTTP.Open "GET", url, False
myHTTP.send ""
If myHTTP.StatusText <> "OK" Then GoTo ServerErrorHandler
If Not (WorksheetFunction.IsNumber(myHTTP.responseText)) Then MYCURRENCYEXCHANGER = 0
MYCURRENCYEXCHANGER = CDbl(myHTTP.responseText)
Exit Function
ServerErrorHandler:
MsgBox "Error. Could not convert currency"
End Function
Any recommendation how to convert the currency correctly so that the . is replaced by a , when fetched from yahoo finance?
I apprecaite your replies!
You can use the function "Replace" to achieve this quite simply.
Function MYCURRENCYEXCHANGER(SourceCur As String, DestCur As String) As Variant
Dim url As String
' http://quote.yahoo.com/d/quotes.csv?s=XXXYYY=X&f=l1 this is the link format where XXX is currency1 and YYY is currency2 '
url = "http://quote.yahoo.com/d/quotes.csv?s=" & SourceCur & DestCur & "=X&f=l1"
Dim myHTTP As New WinHttp.WinHttpRequest
myHTTP.Open "GET", url, False
myHTTP.send ""
If myHTTP.StatusText <> "OK" Then GoTo ServerErrorHandler
Replace(myHTTP.StatusText, ".", ",")
If Not (WorksheetFunction.IsNumber(myHTTP.responseText)) Then MYCURRENCYEXCHANGER = 0
MYCURRENCYEXCHANGER = CDbl(myHTTP.responseText)
Exit Function
ServerErrorHandler:
MsgBox "Error. Could not convert currency"
End Function
The Replace(string, searchtext, replacetext) function will change all occurrences of searchtext by replacetext in your string.
I've not tested it but I'm fairly confident that this should do the trick.