I hate to admit it, but there's plenty of code and comments, and none of it's mine. I would really like to see the functions and how they're written, but more for professional enrichment than anything. The procedures I would post wouldn't really make sense as they're based on the objects and methods in the .dll written by Chilkat. It's pleasantly inexpensive, and even when I needed an additional function, I just asked them, they wrote it and added it to their library. I'm able to concentrate on other aspects of the software, which is really nice. I did include a snippet of the sample code they provide below for working with their activeX objects/methods. This one in particular is the procedure for uploading a file to an S3 server like Amazons S3 or any of the other file-share servers using an S3 API.
I'm probably sounding like a commercial for Chilkat a little, but I haven't really found anyone else publishing up-to-date, useful APIs/helpers in VBA. It's kind of exciting.
Code:
Dim http As New ChilkatHttp
Dim success As Long
success = http.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
Text1.Text = Text1.Text & http.LastErrorText & vbCrLf
Exit Sub
End If
' Insert your access key here:
http.AwsAccessKey = "ABQXXABC83ABCDEFVQXX"
' Insert your secret key here:
http.AwsSecretKey = "XXXXYYYYabcdABCD12345678xxxxyyyyzzzz"
Dim bucketName As String
bucketName = "chilkattestbucket"
Dim objectName As String
objectName = "starfish.jpg"
Dim localFilePath As String
localFilePath = "starfish.jpg"
Dim contentType As String
contentType = "image/jpg"
success = http.S3_UploadFile(localFilePath,contentType,bucketName,objectName)
If (success <> 1) Then
Text1.Text = Text1.Text & http.LastErrorText & vbCrLf
Else
Text1.Text = Text1.Text & "File uploaded." & vbCrLf
End If