Simon Fell > Its just code > April 2002

Thursday, April 11, 2002

Tomorrow marks the one year anniversary of this piece of code, which allowed you to post new blog entries to a Manila hosted blog directly from Word (using PocketSOAP of course). The lack of a spell checker in Radio, combined with my terrible spelling ability prompted me to re-visit this now that I'm in Radio land. The results, a little Word module that allows you to post & update posts from Word to a Radio blog.

Radio implements the Blogger API which is a pure XML-RPC API, however Radio supports both XML-RPC and SOAP, it's a trivial task to enable a SOAP version of the Blogger API. Fire up Radio, open a quick script window and run

    user.soap.rpcHandlers.blogger = @radio.weblog.bloggerApi.rpcHandlers

In additional you'll want to goto the prefs page and make sure that XML-RPC & SOAP are enabled, and that the Blogger API is enabled. Now you can make SOAP calls to manage your blog.

The code is just a few simple Word macros that use PocketSOAP to make the SOAP calls to Radio. Make sure you've got PocketSOAP installed, then download this VBA module. Now fire up Word and select Tools -> Macro -> Visual Basic Editor. Now import the module into your document, or if you want the macro's always available, import them into your template (expand the tree Normal -> Microsoft Word Objects and right click and select Import File).

Look at the top of the code, there are some settings you'll need to tweak. First you'll need to enter your username & password, these are configured in the Remote Access & Security prefs page. If you want to use Word on a different machine to the machine running Radio, you'll need to tweak the RADIO_URL setting. Finally if you need to connect via a HTTP proxy, you can alter the PROXY_SERVER and PROXY_PORT settings.

Now switch back to the main word document window, enter your post and hit Tools -> Macro -> Macros -> select PostNewBlogEntry and hit run. This will send the document as a new post to Radio. Now change the entry and run the UpdateBlogEntry macro, this will prompt you for a postID which will default to the just created post. This will now post the revised text as an edit to the original post. Hey presto you're blogging from Word!

The post takes some simple HTML formatting from the document, link, italics & bold are all carried over.

You can use the Tools -> Customize options to assign the macro's to buttons on the toolbar and/or keyboard shortcuts.