Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Divide word doc sections into word docs
Message
De
11/11/2009 10:15:23
 
 
À
11/11/2009 06:42:39
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01434149
Message ID:
01434225
Vues:
36
Thank you very much!

>>I received a letter which was created by mailmerge. each page is a section and a letter
>>I was asked to take each page and create an individual word documet
>>
>>i figured out ho to access the sections with a for 1 to sections.count loop
>>
>> lcText= oword.activedocument.Sections.Item[lnSectionCnt ].range.text
>>oRange = oword.activedocument.Sections.Item[lnSectionCnt ].range gives me an object
>>
>>can I now create a worddoc with that object and save it??
>>
>>Thanks
>>
>>
>>peter
>
>
>#Define wdSaveChanges	-1
>
>Local oWord, oDoc, ix, lcFileName, lcDocName, lcPath
>lcDocName = 'c:\My Folder\MyMerged.doc'
>lcPath = 'c:\My Folder\MergedDOCS'
>
>If !Directory(m.lcPath)
>  Md (m.lcPath)
>Endif
>
>oWord = Createobject('Word.Application')
>With oWord
>  .Documents.Open( m.lcDocName )
>  oDoc = .ActiveDocument
>  For ix = 1 To oDoc.Sections.Count
>    oDoc.Sections(m.ix).Range.Copy()
>    With .Documents.Add()
>      .Content.Paste
>      .Content.Find.Execute("^b", ,,,,,,,,"")
>      lcFileName = Forcepath(Forceext( ;
>        Juststem( m.lcDocName )+ Padl(m.ix,3,'0'), 'doc' ), m.lcPath )
>      .SaveAs( m.lcFileName )
>      .Close( wdSaveChanges	)
>    Endwith
>  Endfor
>  .Quit()
>Endwith
>
>
>PS: This might take a long time to complete.
>
>Cetin
Peter Cortiel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform