Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Separate huge .doc file into multiple files

Reply  
Thread Tools
Miss HK's Avatar
Junior Member with 21 posts.
 
Join Date: Jan 2009
Experience: Beginner
13-Jan-2009, 09:09 AM #1
Solved: Separate huge .doc file into multiple files
Hi,

I have a massive Word file which I need to split into multiple files.

Basically they look like this:

NEW FILE

RE: Tuesday, December 18, 2007 4:09 AM
To: xxx@xxxxxxxxx.net
Subject: france

TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTVTEXT
TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT

yyyyy@yahoo.com <mailto:yyyyy@yahoo.com>



NEW FILE

RE: Tuesday, December 18, 2007 5:09 AM
To: xxx@xxxxxxxxx.net
Subject: france

TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTVTEXTTEXT
TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT

zzzzz@yahoo.com <mailto:zzzzz@yahoo.com>

NEW FILE

RE: Tuesday, December 18, 2007 6:09 AM
To: xxx@xxxxxxxxx.net
Subject: france

TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTVTEXTTEXTTEXT
TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT
xxxx@yahoo.com <mailto:xxxx@yahoo.com>


And so on and so forth...

I need each NEW FILE to be split and saved as a new file, ideally the name of the new saved file would be the email address (eg. xxxx@yahoo.com)

I tried modifying the Macro created by Rollin_Again in the post : MS Word Help - Macro but to no avail. I also trying finding and replacing the words in my file with those from Rollin's file which seemed to almost work.

Problem is I know nothing about programming, any help welcome!

Last edited by Anne Troy; 27-Jan-2009 at 05:20 PM..
1002richards's Avatar
Computer Specs
Senior Member with 4,542 posts.
 
Join Date: Jan 2006
Location: Sussex, UK
Experience: Intermediate
13-Jan-2009, 10:38 AM #2
Hi and Welcome to TSG,
I've not tried that process myself, but here are some free progs suggested at Portablefreeware.com.
They can be run from a USB so you can avoid cluttering your hard drive if they don't do what you want.

http://www.portablefreeware.com/inde...&m=Search&so=p

I'm sure you'll make a couple of back-ups of your original document just in case something goes haywire!!

Richard

Last edited by 1002richards; 13-Jan-2009 at 10:39 AM.. Reason: Link - as usual!!
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
13-Jan-2009, 11:07 AM #3
We need to find some item that is uniform across all sections at either the beginning or the end of where you want to break the file up.
It would appear that you have an email address along the lines of
<mailto:xxxx@yahoo.com>
at the end of each one. Is that correct?
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.
My theme song... | Affero - rate me!
Chip M's Avatar
Computer Specs
Junior Member with 1 posts.
 
Join Date: Jan 2009
Location: NE PA
Experience: Intermediate
13-Jan-2009, 02:26 PM #4
If it's just a pure split you need, there are loads of freeware that will do that. You specify the exact size of the file and it makes non-working files that can be re-joined to make the original. I use this when I'm trapped using floppies to transfer data. Find one of these at www.filesplitter.org This particular app won't install on your PC (which I like!). It just runs as a direct .exe wherever you download. However, if you want the separate "chunks" to do anything at all (eg. execute, format, etc.) this simple type of program won't produce files that can operate separately. For pure DOS text, it should work fine.
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
13-Jan-2009, 04:28 PM #5
Filesplitter was useful back in the day, but it doesn't split files according to text, just to size - tell it you need 100 1 mb files made from a 100 mb file and you will get them, but they are not in a format that can be read - they have to be reassembled first.
Basically all of 1002 richard's suggestions do the same thing.
No, you need a VBA pro to script this for you.
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.
My theme song... | Affero - rate me!
Elvandil's Avatar
Computer Specs
Moderator with 48,924 posts.
 
Join Date: Aug 2003
Location: Vermont
Experience: "Been through the mill."
13-Jan-2009, 04:38 PM #6
WD2000: How to Programmatically Save Each Page or Section of a Document As Separate File

MS Word Split (Not free.)

You could also convert to PDF and use a PDF splitter. Or Copy and Paste into smaller docs.
computerman29642's Avatar
Computer Specs
Senior Member with 2,794 posts.
 
Join Date: Dec 2007
Location: HERE OR THERE?!?!?!
Experience: Always Learning!
13-Jan-2009, 05:54 PM #7
I found this code:

Code:
Public Sub SplitWordDoc()
 
Dim sPath As String
Dim sName As String
Dim p As Long
Dim docNew As Document
Dim rngSource As Range
 
'gets document application path to provide saving location
sPath = "C:\"
sName = Replace(ActiveDocument.Name, ".doc", "", Compare:=vbTextCompare)
 
'go to start of document
Selection.HomeKey wdStory
 
Application.ScreenUpdating = False
 
'get current page count
ActiveDocument.Repaginate
 
'for each page in the document
For p = 1 To ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
 
    'select the page
    ActiveDocument.Bookmarks("\Page").Range.Select
    'move left 1 character
    Selection.MoveLeft wdCharacter, 1, wdExtend
    'set the range to be copied to new document
    Set rngSource = Selection.Range.FormattedText
 
    'create new document
    Set docNew = Documents.Add
    'copy page contents
    docNew.Range.FormattedText = rngSource
    'save the document
    docNew.SaveAs sPath & sName & "_Page" & p & ".doc"
    'close the document
    docNew.Close True
 
    'go to the next page
    Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext
 
Next p
 
'go to start of document
Selection.HomeKey wdStory
 
Application.ScreenUpdating = True
 
End Sub
This does not save the file by e-mail address.
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
13-Jan-2009, 06:13 PM #8
But doesn't that require that the document have page breaks between each file? I could have posted that, old buddy.
But how does he break the file up into new pages according to the emails?
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
13-Jan-2009, 06:55 PM #9
How about this:
do an Edit, Replace and find each instance of > and replace it with >^m. That will leave the > where it was and insert a manual page break right after it.
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
13-Jan-2009, 07:04 PM #10
found this online
Then this code might work....
Code:
Sub BreakOnSection()
    'Used to set criteria for moving through the document by section.
    Application.Browser.Target = wdBrowseSection

    'A mailmerge document ends with a section break next page.
    'Subtracting one from the section count stop error message.
    For i = 1 To ((ActiveDocument.Sections.Count) - 1)

        'Select and copy the section text to the clipboard
        ActiveDocument.Bookmarks("\Section").Range.Copy

        'Create a new document to paste text from clipboard.
        Documents.Add
        Selection.Paste

        'Removes the break that is copied at the end of the section, if any.
        Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
        Selection.Delete Unit:=wdCharacter, Count:=1

        ChangeFileOpenDirectory "C:\"
        DocNum = DocNum + 1
        ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
        ActiveDocument.Close
        'Move the selection to the next section in the document
        Application.Browser.Next
    Next i
    ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
(Got this at http://word.tips.net/Pages/T001538_M...ual_Files.html)
Miss HK's Avatar
Junior Member with 21 posts.
 
Join Date: Jan 2009
Experience: Beginner
14-Jan-2009, 04:31 AM #11
Thank you all for your input!
I haven't been successful

This code was created by Rollin_Again:

Sub SplitRecords()

vPath = ActiveDocument.Path & "\"

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Text = "OFFICE RECORD"

Do While Selection.Find.Execute = True

vCount = vCount + 1

If vCount > 1 Then

Selection.EndKey Unit:=wdLine

Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.Cut

Do While Selection.Text = " " Or Selection.Text = " "
Selection.Delete Unit:=wdCharacter, Count:=1
Loop

Documents.Add DocumentType:=wdNewBlankDocument
Selection.PasteAndFormat (wdPasteDefault)
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = "OFFICE RECORD"
.Replacement.Text = " "
.Forward = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
Do While Selection.Text = " " Or Selection = " "
Selection.Delete Unit:=wdCharacter, Count:=1
Loop

Selection.Find.Text = "RE:"

Do While Selection.Find.Execute = True
Selection.EndKey Unit:=wdLine, Extend:=wdExtend


If InStr(1, Mid(Selection.Text, 4), " ") > 0 Then
vFile = Trim(Replace(Mid(Selection.Text, 4), " ", ""))
Else
vFile = Trim(Mid(Selection.Text, 4))
End If
ActiveDocument.SaveAs (vPath & vFile & ".doc")
ActiveDocument.Close
Selection.Find.Text = "OFFICE RECORD"
Exit Do
Loop

End If


Loop


End Sub


My idea was to switch "OFFICE RECORD" with my text "NEW FILE"
and Selection.Find.Text = "RE:" to
Selection.Find.Text = " <mailto:xxxx@xxxx.fr>"
but that didn't work...
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
14-Jan-2009, 09:38 AM #12
I have sent a message to Rollin asking him to come check this out - only makes sense....
computerman29642's Avatar
Computer Specs
Senior Member with 2,794 posts.
 
Join Date: Dec 2007
Location: HERE OR THERE?!?!?!
Experience: Always Learning!
14-Jan-2009, 09:46 AM #13
Can we not get a sample file of the Word document?
computerman29642's Avatar
Computer Specs
Senior Member with 2,794 posts.
 
Join Date: Dec 2007
Location: HERE OR THERE?!?!?!
Experience: Always Learning!
14-Jan-2009, 09:47 AM #14
Quote:
Originally Posted by slurpee55 View Post
But doesn't that require that the document have page breaks between each file? I could have posted that, old buddy.
But how does he break the file up into new pages according to the emails?
Sorry. I thought each one was already on a separate page. I will continue to take a look, and see if I can figure something out.
slurpee55's Avatar
Computer Specs
Distinguished Member with 7,837 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
14-Jan-2009, 12:22 PM #15
Well, see my post - #9. It will put a manual page break in at every place the file has something like
<mailto:zzzzz@yahoo.com> (specifically, it will replace the ">" with ">" and a page break).
It appears that there is such an item at the end of each group of text.
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.
My theme song... | Affero - rate me!
Reply

Tags
files, macro, split, word

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:21 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.