I am not a techie, but I can manipulate VB code. I want to create a
routine that allows any of my clients to upload a selection of
contacts from an Access database (our product "CONTACTfile") to
MailChimp by a click of a button. (At the moment, they export to .csv
or Excel, and then upload as a separate process.) The routine (I
guess) will need to identify who they are, log them on, then upload a
previously-created set of contact records stored in an Access query
(or table if necessary). Do you have any such code? I have created a
similar set for another company, but couldn't get it to work without
their help, and as yet they have not given it... perhaps you can? It
would be so neat, for both our organisations, if we could provide
this!
Here's the code so far. It doesn't work because i couldn't figure out
how to stream an xml file. Also, it has a unique API for each user,
which isn't really what's needed, although it would be OK if you're
prepared to provide them as required:
Function UploadData(StrAPIKey, strXml)
Dim xmlhttp, sResponse, xmllength
On Error GoTo Error_UploadData
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", "
http://etc", False
xmlhttp.setRequestHeader "Content-Type", "application/xml"
xmlhttp.setRequestHeader "ApiKey", StrAPIKey
xmllength = Len(strXml)
xmlhttp.setRequestHeader "Content-Length", xmllength
xmlhttp.send "Body=" & strXml
sResponse = xmlhttp.responseText
Set xmlhttp = Nothing
UploadData = sResponse
Exit Function
Error_UploadData:
SendMessage = "Error"
MsgBox "There has been a problem with uploading. Please check that
you have an Internet Connection.", , "Error"
End Function