Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link OLE/ActiveX: Writing text to MS-Word document or template 2004-04-16 -- Glenn Rathke Newsgroups: comp.lang.clarion,softvelocity.clarion.third_party
Actually it is not all that difficult opening and writing to a document.
Here is the code I use to search and replace my own tokens in a word
template: Use as you see fit.
WordMagic Routine
! Save Document As
?Ole{PROP:ReportException} = TRUE !This is to report
any OLE errors
?Ole{PROP:Create} ='Word.Application' !Run Word
?Ole{'Application.WindowState'} = 1 !To Maximize
?Ole{'Documents.Open("' & CLIP(LOC:FileName) & '")'}
?Ole{'Application.Visible'} = True
?Ole{'Application.Selection.Find.Forward'} = -1
?Ole{'Application.Selection.Find.Wrap'} = 1
?Ole{'Application.Selection.Find.Format'} = 0
?Ole{'Application.Selection.Find.MatchCase'} = 0
?Ole{'Application.Selection.Find.MatchWholeWord'} = 0
?Ole{'Application.Selection.Find.MatchWildcards'} = 0
?Ole{'Application.Selection.Find.MatchSoundsLike'} = 0
?Ole{'Application.Selection.Find.MatchAllWordForms'} = 0
Counter# = 0
Loop 6 Times
Counter# += 1
?Ole{'Application.Selection.Find.ClearFormatting'}
?Ole{'Application.Selection.Find.Replacement.ClearFormatting'}
Execute Counter#
Begin
?Ole{'Application.Selection.Find.Text'} = '
Today is November 21, 2024, 6:51 am This article has been viewed 35415 times. Google search has resulted in 643 hits on this article since January 25, 2004.
|
|