Re: NEWBIE:splitting multi-page word doc into single word doc - th

Tech-Archive recommends: Speed Up your PC by fixing your registry



You should be able to modify the code in the following article so that it
incorporates Greg's routine

See the article "Find & ReplaceAll on a batch of documents in the same
folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm


--
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

"aq4word" <aq4word@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1EC3E513-50C9-4E11-8E1C-7886F5D11C72@xxxxxxxxxxxxxxxx
Hi Doug
Have just used your macro for splitting large files. Excellent. Thank you
for that. I have split a 240k file (a Scrabble dictionary that has about
50%
erroneous spellings per MS Spellcheck) into 43 smaller files (page 1, page
2,
etc.). I have then applied Greg Maxey's macro for deleting wrongly spelled
words (Thank you Greg) on just one file, (i.e. Page 1). Works fine, took
about 3 hours.
Question - Is it possible to batch process the other 42 files with Greg's
macro instead of doing them one by one?

"Doug Robbins - Word MVP" wrote:

Sub splitter()

'

' splitter Macro

' Macro created 16-08-98 by Doug Robbins to save each page of a document

' as a separate file with the name Page#.DOC

'

Dim Counter As Long, Source As Document, Target As Document

Set Source = ActiveDocument

Selection.HomeKey Unit:=wdStory

Pages = Source.BuiltInDocumentProperties(wdPropertyPages)

Counter = 0

While Counter < Pages

Counter = Counter + 1

DocName = "Page" & Format(Counter)

Source.Bookmarks("\Page").Range.Cut

Set Target = Documents.Add

Target.Range.Paste

Target.SaveAs FileName:=DocName

Target.Close

Wend

End Sub


--
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

"patti" <patti@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2280C825-3B37-4A1C-928D-2FD59155722D@xxxxxxxxxxxxxxxx
Hi,

Environment: Windows XP/ home edition; sp2
Office 2000 [no help installed and no cd to install help :-( ]
experience: newbie to vba, c coding experience

This request is free of charge for a friend who would do anything for
anyone. His hard drive of clients was hosed and is able to retrive it
from
another source. Unfortunately, the files retrieved are not named
properly
and incompatible with his business operations.


Problem description/vba coding segment requested:

Over 60 documents named xxxxxnnnn.doc that contain client info,
delimited
with over 65 page breaks. Within each page break contains the client
info,
which needs to be extracted into their own word document, and take on
the
name: client_name_date_of_service.doc to easily distinguish it.

Relevant client information (including ultimate file name) is contained
within each page break in the larger document. Last record in original
file
may not contain the page break, but I'd still like to be able to
capture
this
one as well.

Filename containing relevant client information should be of the form
client_name_date_of_service.doc (this information is contained within
each
page break)

Objective:
- Cycle through all the word documents (approx 60 files) in a given
folder
-for each large document file (over 60 files) -- start the
splitting
process
- open each file
- for each page break found (between 65 - 80 page breaks)
- for each paragraph in each page break
- capture the first line of each page [this is the
client
name]
- for each paragraph [search for the string "date"]
- generate the client name (eg.joe_smith_1_24_07.doc)
and
save in a string variable
- capture the entire page
---> including final page break for each page
---- select the contents of this page break and copy
the
entire page,
including trailing page break [if absolutely
necessary,]
into client_name_date_of_service.doc.
(eg. joe_smith_1_24_07.doc)
- next [for each page break until no more page breaks in this
file
-- note: the final client info. may not contain the
trailing
page break,
but I'd still like to be able to capture it and
store it in its proper
clientname_date_of_appt.doc
- next [for each file containing all the client data within the
page
breaks]
- close/properly dispose of any allocated resources
- error handler to close/dispose to determine the cause of the
failure
and properly shutdown the application.

?? any additional steps that I've neglected to mention.

I enjoy helping people and learning new things. Many thanks to all
who
take the time to share their time and talents by responding witih the
code
capable of accomplishing this task.

With much gratitude and appreciation,
Patti






.



Relevant Pages

  • Re: NEWBIE:splitting multi-page word doc into single word doc - th
    ... Thanks for your timely response Doug. ... Have just used your macro for splitting large files. ... Over 60 documents named xxxxxnnnn.doc that contain client info, ... capture the first line of each page [this is the ...
    (microsoft.public.word.vba.general)
  • Re: NEWBIE:splitting multi-page word doc into single word doc - th
    ... Have just used your macro for splitting large files. ... Over 60 documents named xxxxxnnnn.doc that contain client info, ... may not contain the page break, but I'd still like to be able to capture ...
    (microsoft.public.word.vba.general)
  • Re: sorting by last name
    ... of the file being the LastNameFirstName and then use a macro to recombine ... Dim Counter As Long, Source As Document, Target As Document ... >I have 150 pages in Word that I would like to sort based on client LAST ...
    (microsoft.public.word.mailmerge.fields)
  • Re: autofill of a textbox from a listbox selection
    ... ' Open the file containing the client details ... ' Get the number of columns in the table of client details ... The Initialize statement will populate the listbox with the data from the ... My assumption is the Macro that I am creating ...
    (microsoft.public.word.vba.userforms)
  • RE: Taking info from all sheets and compiling it without spaces
    ... What I am doing exactly is taking the client lists of all my ... co-workers and compiling them into one master sheet. ... individual sheets, and with the help of a macro, be able to automatically ...
    (microsoft.public.excel.programming)