Here's one
Rem Bookseller - Creative Computing
Rem The following macro automates the merging of data exported by Bookseller
with the Word templates.
Public Sub MAIN()
WordBasic.ScreenUpdating 0
WordBasic.EditFindClearFormatting
WordBasic.EditReplaceClearFormatting
WordBasic.PrintStatusBar "Please wait... processing Catalogue"
Rem If you have installed Bookseller in a different directory/folder you
will have to edit the path in the line below to indicate the location of the
file Cat-10pt.dot.
WordBasic.FileOpen Name:="C:\Booksell\Wordfile\BKSWeb.dot",
ConfirmConversions:=1, ReadOnly:=1
WordBasic.MailMerge CheckErrors:=1, Destination:=0, MergeRecords:=0,
Suppression:=0, MailMerge:=1
Rem Carriage returns within Bookseller fields are imported into Word as new
line characters (ASCII 11). The following steps converts these to carriage
returns (ASCII 13) and undo any additional paragraph formatting which may be
transferred to the section f
'ollowing the carriage return.
WordBasic.StartOfDocument
WordBasic.EditFind Find:="^l", Direction:=0, Wrap:=2
While WordBasic.EditFindFound()
WordBasic.InsertPara
WordBasic.FormatParagraph Before:="0 pt", After:="0 pt", FirstIndent:="0cm"
WordBasic.RepeatFind
Wend
Rem Following lines convert Author placeholder spaces to tabs for consistent
alignment. Then the placeholder is removed from the Index field to stop the
dash being indexed. Hidden text must be switched on to remove the hidden
index fields.
WordBasic.StartOfDocument
WordBasic.ShowAll 0
WordBasic.EditReplaceTabs Position:="2 cm", Align:=0, Leader:=0
WordBasic.EditReplace Find:="—— ", Replace:="——^t", Direction:=0,
ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.ShowAll 1
WordBasic.EditReplace Find:=Chr(34) + "—— " + Chr(34), Replace:="",
Direction:=0, ReplaceAll:=1
WordBasic.ShowAll 0
WordBasic.ViewFieldCodes 0
WordBasic.StartOfDocument
Rem The next steps open the template and closes it. Only the new catalogue
document will remain open.
WordBasic.FileOpen Name:="C:\Booksell\Wordfile\BKSWeb.dot"
WordBasic.FileClose (2)
WordBasic.ScreenUpdating 1
Rem The following lines can be deleted (as far as 'End Sub').
WordBasic.MsgBox "Your catalogue is now ready for editing or printing. To
alter the font size of the whole document, select all the text (Ctrl+A) and
press either < or >, while holding down Ctrl+Shift.", " Standard Catalogue
(10pt)", 64
End Sub