If you want to send an XML-RPC payload to WordPress from Microsoft Office (e.g. Excel) then you can use the following function. In there the wpURL is expected e.g of the form “http://#yourDomain#/xmlrpc.php “, where you have to replace “#yourDomain#” by your blog address. wpUserName, wpPassword is your credentials and the wpXMLRPC is the xml payload which can be created also in VBA using basic VBA functionality and based on the specification described in “http://codex.wordpress.org/XML-RPC_MetaWeblog_API “. Please note that you have to add a library reference to a “Microsoft XML” library in the VBE (VB Editor) (e.g. “Microsoft XML, v6.0” in “Tools -> References”).

In later posts we will see how to prepare messages using basic functionality (XML parser free) so that you can maintain easily.

Function wpPost(ByVal wpURL As String, ByVal wpUserName As String, ByVal wpPassword As String, ByVal wpXMLRPC As String) As String
    Dim oHTTP As XMLHTTP, wpResponse As String
    ' VBAProject References needed: "Microsoft XML"
    ' wpURL: e.g. "http://#yourDomain#/xmlrpc.php "
    ' wpXMLRPC see: http://codex.wordpress.org/XML-RPC_MetaWeblog_API
    Set oHTTP = New XMLHTTP
    Call oHTTP.Open("POST", wpURL, False, wpUserName, wpPassword)
    Call oHTTP.setRequestHeader("Accept", "application/xml")
    Call oHTTP.setRequestHeader("Content-Type", "application/xml")
    Call oHTTP.Send(wpXMLRPC)
    wpResponse = oHTTP.responseText
    Set oHTTP = Nothing
    wpPost = wpResponse
End Function