Re: split msWord Document



Try the following (Save you document first, it has not been tested!):

Dim Source As Document, target As Document, myrange As Range, i As Long
Set Source = ActiveDocument
i = 1
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="yourkeyword", MatchWildcards:=False,
Wrap:=wdFindContinue, Forward:=True) = True
Set myrange = Selection.Range
myrange.Start = Source.Start
myrange.Cut
Set target = Documents.Add
target.Range.Paste
target.SaveAs "doc" & i
i = i + 1
Loop
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
"Bilal Niaz" <Bilal Niaz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8A773089-AB92-495A-91E3-FB8D2BF54C2B@xxxxxxxxxxxxxxxx
> Hi,
>
> I want to split my single word document into multiple word documents or
> images. The number of peices depend upone a particular keyword.
>
> When ever there is a keyword all the upper portion will be saved to
> another
> word document.
>
> I have been tryin to do it through VB. But, still could not find a
> solution.
>
> Hope to have cooperation.
>
> Thanks,
>
> Bilal
>
> P.S: The word document contains chines charactors too along with english
> charactors, and also the images.


.



Relevant Pages

  • split msWord Document
    ... I want to split my single word document into multiple word documents or ... The number of peices depend upone a particular keyword. ... The word document contains chines charactors too along with english ... charactors, and also the images. ...
    (microsoft.public.word.vba.general)
  • Re: split msWord Document
    ... > Dim Source As Document, target As Document, myrange As Range, i As Long ... The number of peices depend upone a particular keyword. ... The word document contains chines charactors too along with english ... >> charactors, and also the images. ...
    (microsoft.public.word.vba.general)
  • How can I customise Search.htx to include a link to contacts as well as filename?
    ... I have a document library set up whereby when a document is uploaded ... contact record as well as the document filename, ... a keyword (stored in a word document) then return results that link to ...
    (microsoft.public.sharepoint.teamservices)
  • Search using parts of whole words
    ... Is it possible to search via Index Service using only ... For example: say the word 'Keyword' ... existed in a Word document; ... in 'Key' (no inverted commas) to search and find documents ...
    (microsoft.public.inetserver.indexserver)
  • New to VBscript, Help please!
    ... It is my first time to write a Vb script to automate Word document ... keyword, then Bold it. ...
    (microsoft.public.scripting.vbscript)