rebol [ Title: "Word open save" File: %word-open-save.r Date: 29-Jun-2006 Version: 1.0.0 Progress: 0.55 Status: "working" Needs: [] Author: "Anton Rolls" Language: "English" Purpose: {Save a Word document.} Usage: {} History: [ 1.0.0 [29-Jun-2006 {First version, converted from Ben's version} "Anton"] ] ToDo: { - add the to-be-saved filename into the document before saving. } Notes: {} ] if error? set/any 'error try [ do/args %../COMLib.r [ ; Use the COMLib API functions here. END_OF_STORY: 6 MOVE_SELECTION: 0 word_obj: createObject "Word.Application" PutValue [word_obj ".Visible = %s" "TRUE"] word_doc: GetObject [word_obj ".Documents.Open(%s)" to-local-file clean-path %demos/word-open.doc] objSelection: GetObject [word_obj ".Selection"] CallMethod [objSelection ".EndKey %d, %d" END_OF_STORY MOVE_SELECTION] CallMethod [objSelection ".TypeParagraph()"] CallMethod [objSelection ".TypeParagraph()"] PutValue [objSelection ".Font.Size = %d" 24] CallMethod [objSelection ".TypeText(%s)" join "Last date: " now ] CallMethod [word_doc ".SaveAs(%s)" to-local-file clean-path %demos/word-saved.doc] release word_doc release word_obj ] ][ print mold disarm error ]