Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2018, 11:13 PM
macropod's Avatar
macropod macropod is offline mining 4k page word document Windows 7 64bit mining 4k page word document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


I doubt anyone would have connected your 'user story categories' with what's in your document. Try:
Code:
Sub ExtractUserStories()
Application.ScreenUpdating = False
Dim DocSrc As Document, DocTgt As Document, Tbl As Table, Rng As Range
Dim ArrRls, i As Long, r As Long, bExp As Boolean
ArrRls = Array("Profit Analyzer", "Deal Manager", "Price Manager")
Set DocSrc = ActiveDocument
For i = 0 To UBound(ArrRls)
  Documents.Add (DocSrc.AttachedTemplate.FullName)
  ActiveDocument.SaveAs2 FileName:=DocSrc.Path & "\" & ArrRls(i) & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
Next
With DocSrc.Range
  .ListFormat.ConvertNumbersToText
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Style = wdStyleHeading1
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    Set Rng = .Paragraphs(1).Range
    Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\HeadingLevel")
    For i = 0 To UBound(ArrRls)
      For Each Tbl In Rng.Tables
        bExp = False
        With Tbl
          If InStr(.Range.Text, ArrRls(i)) > 0 Then
            Set DocTgt = Documents(ArrRls(i) & ".docx"): bExp = True
            With DocTgt
              With .Range
                .Characters.Last.FormattedText = Rng.FormattedText
                .InsertAfter Chr(12)
              End With
              .Save
              DoEvents
            End With
            Exit For
          End If
        End With
      Next
    Next
    .Start = Rng.End
    .Find.Execute
  Loop
End With
For i = 0 To UBound(ArrRls)
  Documents(ArrRls(i) & ".docx").Close True
Next
DocSrc.Undo (1)
Set Rng = Nothing: Set DocTgt = Nothing: Set DocSrc = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 07-10-2018, 03:54 PM
lemonap618 lemonap618 is offline mining 4k page word document Windows 7 64bit mining 4k page word document Office 2010 64bit
Novice
mining 4k page word document
 
Join Date: Jul 2018
Posts: 3
lemonap618 is on a distinguished road
Default

Thank you so much for the response - very helpful!
Reply With Quote
Reply

Tags
data mining



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have 20 page word document with a footer. Can i change page # 10 footer only? aligahk06 Word 2 10-25-2017 04:53 AM
Running Head AND Page Number on First Page of Document (for APA Format) with Word 2003 DBinSJ Word 3 11-23-2016 11:52 AM
Adding a link into a word document that when pressed, takes user to a page within the same document yan89 Word 1 04-29-2016 01:54 PM
2 page document printing problem, text from page 1 in layout of page 2 when printed laurawether45 Word 1 08-02-2012 07:03 AM
mining 4k page word document 600 page document in word 2007 ggun123 Word 3 08-23-2011 06:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft