I am trying to use the "wininet.dll" set of API's to download a single file of an FTP server. Listed below is the final procedure. I have not listed the constands or the API declerations.

If I use this code with my ISP from home it works perfectly, but if I use it at work on our LAN through a proxy server it will not work.

If I use FTP.exe to download the file at work it works perfectly.

WHY WONT THIS WORK ON THE LAN. I have been up and down the NET on countless forums and help pages with tons of tutorials.

PLEASE SOMEONE HELP!!!

Sub Download()

*****Gets the OPEN handle fine
hOpen = InternetOpen("My Live Update program", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)

If hOpen = 0 Then GoTo cls

****Gets the connection handle fine
hConnection = InternetConnect(hOpen, "ftp.hp.com", INTERNET_DEFAULT_FTP_PORT, "username", "password", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)

If hConnection = 0 Then GoTo cls

***THIS IS Where it goes wrong. chd returns false
chd = FtpSetCurrentDirectory(hConnection, "pub/visualize/")
dld = FtpGetFile(hConnection, "TopToolsRMDB.txt", "c:\TopToolsRMDB.txt", False, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0)

cls:
On Error Resume Next
InternetCloseHandle hConnection
'close the internet connection
InternetCloseHandle hOpen
Exit Sub
End Sub