I am trying to use wininet.dll in Access 2010 VBA, and need some help1

PaulCutcliffe

New member
Local time
Today, 19:03
Joined
Dec 13, 2012
Messages
1
My Access database still has some code in it that I haven't been able to get working since upgrading the database (I think, although this was a few years ago now).

The old code used 'Inet ', which I believe is no longer available in VBA, for some unfathomable reason.

I believe I can do what I need using MSXML - see msdn.microsoft.com/en-us/library/aa505329.aspx (sorry, apparently I'm not allowed to post links yet)

But I need to PUT a file, rather than GET one, although ideally I'd like to check for the existence of a file (via FTP or HTTP) first.

I have the following two functions, which I need to replace:

Function FTPUploadFile(ByVal strURL As String, ByVal UserName As String, ByVal Password As String, _
ByVal LocalFileName As String, ByVal RemoteFileName As String) As Integer

Dim FTP As Inet

Set FTP = New Inet
With FTP
.URL = strURL
.Protocol = icFTP
.UserName = UserName
.Password = Password
.Execute .URL, "Put " + LocalFileName + " " + RemoteFileName
Do While .StillExecuting
DoEvents
Loop
FTPUploadFile = .ResponseCode
End With
Set FTP = Nothing
End Function

Function HTTPFileExists(URL As String) As Boolean
Dim HTTP As Inet
Dim S As String
Dim Exists As Boolean

Set HTTP = New Inet
With HTTP
.Protocol = icHTTP
.URL = URL
.Execute
Do While .StillExecuting
DoEvents
Loop
S = UCase(.GetHeader())
Exists = (InStr(1, S, "200 OK") > 0)
End With
Set HTTP = Nothing
HTTPFileExists = Exists
End Function

Can anyone help me?
 

Users who are viewing this thread

Back
Top Bottom