Here's an example of how to use TextPipe's COM interface from within a Microsoft Word macro:
Sub TextPipeCOMExample()
'
' Macro by Simon Carter, DataMystic
' Demonstrates running TextPipe on a Word Document using COM
Dim TaskId
Dim TextPipePath
Dim FilterName
Dim pathname
Dim TP As TextPipe.Application
Dim f As TextPipe.FilterWindow
FilterName = "c:\myfilter.fll"
Set TP = CreateObject("TextPipe.Application")
TP.Show
Set f = TP.NewWindow
f.openFilter (FilterName)
f.startFilters
f.InputMode = 0
f.OutputMode = 0
f.endFilters
'select the entire document
Selection.WholeStory
'copy the entire document to the clipboard
Selection.Copy
f.executeClipboard
f.CloseWithoutSave
Set f = Nothing
Set TP = Nothing
'paste the result in, overwriting the original
Selection.WholeStory
Selection.Paste
End Sub
Did you know? You can generate VBScript or JScript code from a filter prototype by choosing File Menu\Export\Export VBScript or Export JScript. You can even generate a web page to run a filter from a friendly front-end.
Buy Download Tour