Thread: [Solved] export text by style
View Single Post
 
Old 12-22-2019, 08:17 PM
yacov yacov is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Oct 2019
Posts: 146
yacov is on a distinguished road
Default

No it's local.
i found that script:
How Can I Extract Word Paragraphs That Use a Specific Style? | Scripting Blog
how can i change the file name to the document that is open?


Set objWord = CreateObject(“Word.Application”)

objWord.Visible = True

Set objDoc = objWord.Documents.Open(“C:\Scripts\Test.doc”)

Set objSelection = objWord.Selection

Set colParagraphs = objDoc.Paragraphs


For Each objParagraph in colParagraphs

If objParagraph.Style <> “Heading 1” Then

objParagraph.Range.Select

objSelection.Cut

End If

Next


objDoc.SaveAs(“C:\Scripts\Headings.doc”)

objWord.Quit
Reply With Quote