Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-28-2018, 07:08 AM
XRope XRope is offline Extract List of terms and combine on a Table Windows 7 64bit Extract List of terms and combine on a Table Office 2010 32bit
Novice
Extract List of terms and combine on a Table
 
Join Date: Jun 2018
Posts: 17
XRope is on a distinguished road
Default Extract List of terms and combine on a Table

Hi everyone,

I would like to make a macros to extract text within parentheses and all countries names in order of apearence within 2 open word documents and combine them on a new document for revision.
I suppose I have to provide the list of countries

I have a macro to extract and put on a table text within parentheses but it only works for one document. I want to add extraction of all countries listed in the doc too. and that it processes both open documents. There is no need for autosave since its only for revision.

Here the macro for extracting text within parentheses.

Sub ExtractText()
Dim cDoc As Word.Document, nDoc As Word.Document
Dim cRng As Word.Range, nRng As Word.Range

Set cDoc = ActiveDocument
Set nDoc = Documents.Add

Set cRng = cDoc.Content
Set nRng = nDoc.Content

cRng.Find.ClearFormatting
With cRng.Find
.Forward = True
.Text = "("
.Wrap = wdFindStop
.Execute
Do While .Found
cRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
cRng.MoveEndUntil Cset:=")", Count:=Word.wdForward
nRng.FormattedText = cRng.FormattedText
nRng.InsertParagraphAfter
nRng.Collapse Word.WdCollapseDirection.wdCollapseEnd
cRng.Collapse Word.WdCollapseDirection.wdCollapseEnd


.Execute
Loop
End With
End Sub


thanks a lot
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract List of terms and combine on a Table Need macro to make list of "defined terms" glnz Word VBA 8 09-07-2022 02:09 PM
How to extract names from a list flyoverrunner Excel 3 06-06-2018 04:54 AM
Extract List of terms and combine on a Table Best Practice for Indexing Multiple Word Terms and Sub-Terms jhy001 Word 4 11-06-2017 02:08 PM
Extract List of terms and combine on a Table How to Combine a Table of Contents Page with Another Document Dante49 Word 2 10-24-2016 01:53 PM
Extract List of terms and combine on a Table Need to extract two word domains from a list (BULK) Maxwell314 Excel 3 12-08-2014 06:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:39 AM.


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