Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-06-2014, 09:12 AM
Hoxton118 Hoxton118 is offline VBA code to compile one document based on multiple search terms Windows 7 32bit VBA code to compile one document based on multiple search terms Office 2010 32bit
Novice
VBA code to compile one document based on multiple search terms
 
Join Date: Mar 2014
Posts: 21
Hoxton118 is on a distinguished road
Default VBA code to compile one document based on multiple search terms

I have the following code which allows me to select a search term and create a single new document which includes only those paragraphs containing the search term. I enter the search term in an input box.

Is there a way of getting the code to use a list of search terms from another file (whether Excel or Word) so that, rather than entering each search term individually, it will do multiple search terms at once - all results ending up in one document.

Another solution would be to enable a Boolean search in the input box, so that I could ask for multiple search terms there.

I would be very grateful for any help. Thanks.

Code:
Sub CreateSummary()
'
' CreateSummary Macro

Selection.Find.ClearFormatting
With Selection.Find
 .Text = InputBox("Type search term and press Enter.")
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
Selection.StartOf Unit:=wdParagraph
Selection.MoveEnd Unit:=wdParagraph
sBigString = sBigString + Selection.Text
Selection.MoveStart Unit:=wdParagraph

Loop
Documents.Add DocumentType:=wdNewBlankDocument
Selection.InsertAfter (sBigString)
End Sub

Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to compile one document based on multiple search terms Vba macro code for grouping the data based on 2 hours time dharani suresh Excel Programming 5 04-29-2014 03:25 AM
Search and replace/insert HTML code into Master File using tags dave8555 Excel 2 02-23-2014 03:51 PM
VBA code to compile one document based on multiple search terms Character based Search and Replace font size anacond11 Word 2 08-08-2013 08:10 AM
How do I search for terms in initial upper-case? bertietheblue Word 5 05-02-2012 05:24 AM
Modify vba code to print based on name in the InputBox OTPM Project 0 05-25-2011 02:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:41 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