#1
|
|||
|
|||
Splitting Word Document based on line content
We have this working document that is curated by individual parties on both sides of an ocean. In the document is daily information on projects, news, etc and pertains to individual staff members on either side. This makes it nearly impossible to make it easy to read for any one person. I've tried my best to get everyone to move to basically *anything* else, but stubborn...
So the document is laid out like: Topic / Person / Engineer Content Content Content <space> Topic / Person / Engineer <repeat above> What I'd like to do is read line by line selecting, cutting and pasting into individual new documents based on "Person". I've run into nothing but problems. I am looping line by line using Selection.MoveDown and I am able to properly select a section, but when I need to check the current position for the next "title" marker I lose my selection. Frustrating. There's gotta be a simple way to do this. Any suggestions where to start? Notes: Doc could be 10-50 pages long Content could be any number of things (multiple lines, paragraphs, tables) I could put in some sort of actual delimiters. Currently there are Horizontal Lines between each section. I hate this document... |
#2
|
||||
|
||||
Does the document have a proper structure, for example, the use of Heading Styles for Topic / Person / Engineer and one or more different Styles for the remainder? If not, how is a macro supposed to recognise when Topic / Person / Engineer occurs, other than by a preceding <space> (by which I guess you mean an empty paragraph and never via paragraph formatting), especially if there's the potential for such spaces to occur elsewhere?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Quote:
I can add some type of delimiter if that would help. |
#4
|
||||
|
||||
Splitting a document via macro requires a consistent pattern in the content that can be used to locate the range spanned by each portion. For example, you refer to them starting with a 'Topic / Person / Engineer' heading. Is that the literal text, or just a description? If it's a description, is there a pattern or even a format that one could rely on to differentiate these headings from everything else?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Quote:
4437R Sourcing Issue / Karen / Lisa / Jim Topic / SalesPerson / Account Manager / Engineer I thought about adding markers for delimiters "***4437R Sourcing Issue / Karen / Lisa / Jim" |
#6
|
||||
|
||||
OK, so does every heading contain three forward slashes (i.e. /)? Do the Topics always begin with a number?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Not every heading currently contains 3 slashes, but I can make that a requirement of the editors of the document. NO, topics can be anything and do not solely start with numbers.
|
#8
|
||||
|
||||
Does every heading contain a single forward slash (i.e. /) before 'person'?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
It certainly can. For the most part, does now. But it should be noted that there could be forward slashes elsewhere in the document besides the title. I'm open to some other less used delimiter or coded delimiter of some type.
|
#10
|
||||
|
||||
What I am trying to establish is whether there is a useable pattern that can be used to automate the process in some way. All your replies suggest not, in which case you may as well stick with laboriously copying & pasting content to new documents. Going through a document adding delimiters, etc. so that an automated process could be developed and applied would probably take about as long, overall.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Quote:
We use and update this document daily. |
#12
|
||||
|
||||
So why not start with a new document for each day? Your current process seems to be making a rod for your own backs, so to speak. In any event, if you're only splitting out a day's content at a time to a single document, you hardly need a macro for that.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
Quote:
We create a topic: 12345 Sourcing Issue Bob / Karen / Rich 10/6 Karen: You guys failed to source the materials for this PN 10/6 (Factory Person): Oh sorry about that, you know how it is 10/7 Bob: Yeah, blah blah blah you guys do this to us all the time 10/9 (Factory Person): OK we finally got the materials, now what? 55432 Part Burned Down Customer Location! Julie / Mike / Steve 10/1 Julie: Just heard that this part caused a fire at a customer location 10/2 (Factory): That sucks, you know Chinese parts! 10/3 Julie: No seriously, WTF Batman. Replies are made to topics on a daily basis. This document can have months of conversations spanning 10-30 pages. Every day we make our replies, send it over to factory. Their day (our night) they make their replies and send back. We continue working off the same document every day. I just want to bust everything out by one of the names in the title. So all topics with Bob end up in a "BOB.DOC" and all with Julie end up in "Julie.DOC" Trust me I can't stand this thing. But China can be frustratingly bad to work with. I actually wanted to turn the whole thing into a user forum, but the cry babies on both sides of the ocean are whining about it already. Some people can't take change. |
#14
|
||||
|
||||
So how would those two examples look when exported, and how many files would they produce?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
|||
|
|||
Quote:
12345 Sourcing Issue Bob / Karen / Rich 10/6 Karen: You guys failed to source the materials for this PN 10/6 (Factory Person): Oh sorry about that, you know how it is 10/7 Bob: Yeah, blah blah blah you guys do this to us all the time 10/9 (Factory Person): OK we finally got the materials, now what? 55432 Part Burned Down Customer Location! Julie / Mike / Steve 10/1 Julie: Just heard that this part caused a fire at a customer location 10/2 (Factory): That sucks, you know Chinese parts! 10/3 Julie: No seriously, WTF Batman. XYZ Company Needs New Label Bob / Carl / Susan 9/29 Bob: Company requests their zip code on box label 9/30 (Factory): That's crazy, who needs a zip code on a label 10/1 Bob: It's what the customer wants, do it 10/2 (Factory): OK. If we have to So in the above 3 post examples I would want them to split out into documents based on the "SalesPerson" label (the first name in the 3-name splits). So in the three above examples there are only 2 sales person topics Bob and Julie so... BOB.DOCX 12345 Sourcing Issue Bob / Karen / Rich 10/6 Karen: You guys failed to source the materials for this PN 10/6 (Factory Person): Oh sorry about that, you know how it is 10/7 Bob: Yeah, blah blah blah you guys do this to us all the time 10/9 (Factory Person): OK we finally got the materials, now what? XYZ Company Needs New Label Bob / Carl / Susan 9/29 Bob: Company requests their zip code on box label 9/30 (Factory): That's crazy, who needs a zip code on a label 10/1 Bob: It's what the customer wants, do it 10/2 (Factory): OK. If we have to JULIE.DOCX 55432 Part Burned Down Customer Location! Julie / Mike / Steve 10/1 Julie: Just heard that this part caused a fire at a customer location 10/2 (Factory): That sucks, you know Chinese parts! 10/3 Julie: No seriously, WTF Batman. Now there could be 10,20,30,100 topics per sales person spanning several pages. In general we have about 5 sales people to do split this document into. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
split word document based on bookmarks with each new document title of the bookmark | megatronixs | Word VBA | 9 | 09-05-2020 02:29 PM |
More than one content controls in a word document | lucky16 | Word VBA | 6 | 07-10-2014 08:34 AM |
Document splitting | MsLavigne | Word | 2 | 05-09-2012 05:52 AM |
WORD 2003 Need help splitting a HUGE Document | dlawson | Word | 4 | 04-14-2009 12:22 PM |
How to add Table of Content in word document by C# ! ! ! | arun singh | Word | 0 | 11-12-2008 11:21 PM |