General information
Category:
COM/DCOM and OLE Automation
>>Try this:
>>*---------------------
>>lcfile1="c:\encrypting.doc"
>>lcfile2="c:\If Operating Systems were beers.doc"
>>wdStory=6
>>wdSectionBreakNextPage=2
>>
>>oWord = CREATEOBJECT("word.application")
>>with oWord
>> .Documents.open(lcfile1)
>> .Selection.EndKey(wdStory)
>> .Selection.InsertBreak(wdSectionBreakNextPage)
>> .Selection.InsertFile(lcfile2,"", .f.,.f.,.f.)
>>endwith
You should be able to speed this up a little by using the Range object instead of the Selection object. (In general, you should use Range wherever possible rather than Selection.)
WITH oWord
.Documents.Open(lcFile1)
oRange = .ActiveDocument.Range()
ENDWITH
WITH oRange
.Collapse(wdCollapseEnd)
.InsertBreak( wdSectionBreakNextPage )
.Collapse(wdCollapseEnd)
.InsertFile(lcFile2, "", .f., .f., .f.)
ENDWITH
Warning: untested code, just a translation of Yuri's code.
Tamar
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only