error with API URLDownloadToFileA & 4832
Hi !
I am Using the URLDownloadToFileA API from PsWindowsXP in a VBA for Excel.
when I use the following link in my script I have a relevant result :
http://crm.zoho.com/crm/private/xml/Accounts/getMyRecords?ticket=xxxxxxxxxxxxxxxxxxxxx&apikey=xxxxxxxxxxxxxxxxxx
When I use the follwing link, the script generates an error (I only change Accounts to Quotes): (URLDownloadToFileA returns the error, that problably means windows dod not manage to open the link)
http://crm.zoho.com/crm/private/xml/Quotes/getMyRecords?ticket=xxxxxxxxxxxxxxxxxxx&apikey=xxxxxxxxxxxxxxxxxxxx
If I copy/paste the same link in my firefox on IE, I have the exprected result as xml format.
as I have renamed my "Quotes" table into "Devis" (In French) the VBA script dos not generale any arror, but the return valur of Zoho CRM is error 4832.
to sumerise :
Accounts : relevant result
All tables traslated into French = error if i copy the link in my web browser (error 4832)
All tables traslated into French = the API URLDownloadToFileA API is OK, BUT the xml file say error 4832.
All tables with request in English = relevant result when I copy the link in my wheb browser
all (except Accounts) tables with request in English = the API URLDownloadToFileA returns an error.
anyone has an idea ?
please find below my script in VBA for Excel.
------------------------
Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szUrl As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
------------------------
Function DownloadPage(ByVal url As String, ByVal FileName As String) As Boolean
Dim done As Boolean
Dim value As Long
On Error Resume Next
done = True
If Dir$(FileName) <> "" Then
Kill FileName
End If
value = URLDownloadToFile(0, url, FileName, 0, 0)
If Dir$(FileName) = "" Then
done = False
End If
DownloadPage = done
End Function
------------------------
------------------------
'
' Exemple d'utilisation de la fonction DownloadPage
'
Private Sub Command1_Click()
Dim bRet As Boolean
Dim sURL As String
Dim sFileName As String
Dim API As String
Dim ticket As String
sURL = "http://crm.zoho.com/crm/private/xml/Quotes/getMyRecords?ticket=xxxxxxxxx&apikey=xxxxxxxxxxx"
sFileName = "c:\test10.dat"
bRet = DownloadPage(sURL, sFileName)
If bRet Then
MsgBox "Download ok."
Else
MsgBox "Error in Download"
End If
End Sub