`
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'} = ' Printed November 21, 2024, 6:39 am This article has been viewed/printed 35414 times. Google search has resulted in 643 hits on this article since January 25, 2004. |