#1
|
|||
|
|||
Search the words of different document
I have active document, which is opened, need search for the symbols and special words from the different document whether those will available in this they should be highlighted.
|
#2
|
|||
|
|||
Document search and highlight
Search for the strings i.e. one are two spaces words and symbols which are existing in different document. if they found in active document they should highlight.
Please do the needful. |
#3
|
|||
|
|||
Please help me.
|
#4
|
||||
|
||||
Such impatience (3 posts on the same topic in 6 minutes) does nothing to endear you to anyone who might be inclined to help.
As it is, a Search of these forums will return a number of threads in which the use of search terms in a document, text file or Excel worksheet can be used for running a Find/Replace operation on one or more documents.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Macro to search for phrases in the word document
Dear All,
Please hep me in this regard I would like to search and highlist the phrases ex: "can not", "has to", "have to" and "such as" |
#6
|
||||
|
||||
Create a document with a single column table. Put one of the phrases in each cell (no blanks) save the document then put the name and path in the following macro in place of "C:\Path\Table.docx". Run the macro on your document with the phrases.
Code:
Sub Highlighting() Dim oChanges As Document, oDoc As Document Dim oTable As Table Dim oCell As Cell Dim oRng As Range Dim rFindText As Range Const sFname As String = "C:\Path\Table.docx" Set oDoc = ActiveDocument Set oChanges = Documents.Open(Filename:=sFname, Visible:=False) Set oTable = oChanges.Tables(1) For Each oCell In oTable.Range.Cells If Len(oCell.Range) > 2 Then Set oRng = oDoc.Range Set rFindText = oCell.Range rFindText.End = rFindText.End - 1 With oRng.Find .ClearFormatting .Replacement.ClearFormatting Do While .Execute(FindText:=rFindText, _ MatchWholeWord:=True) = True oRng.HighlightColorIndex = wdBrightGreen Loop End With End If Next oCell lbl_Exit: oChanges.Close 0 Set oChanges = Nothing Set oDoc = Nothing Set oRng = Nothing Set rFindText = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#7
|
||||
|
||||
Sandhya: This is the fourth post you've made today on essentially the same topic. Did you even bother to look at any of the numerous threads that have already discussed and resolved such issues, as suggested in post #4, above?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
search and highlight the symbols and special characters
Dear Sll,
please help me search for special characters like cd/in2, Ci, dm2, dm2, ft 2/s and so on. please help me for write macro. |
#9
|
|||
|
|||
Thank you so much for your help, can and add the symbols and special charaters also in the tabble??
please help me. |
#10
|
||||
|
||||
Whatever you enter in the table will be added to the search list.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#11
|
||||
|
||||
See your other thread - https://www.msofficeforums.com/word-...-document.html
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#12
|
||||
|
||||
Sandhya: Kindly don't keep starting new threads on the same topic. So far, this is the fourth thread you've started on this topic and it looks very much like you simply expect people to do everything for you - immediately. This is not a free coding forum for impatient people who are too lazy to either search for solutions to similar problems or to learn from the solutions they have already been given...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
Seach for the whole word
Dear All,
As below code i am able to search for the words existing in the table, but it is not checking as a whole in active document. example: if i keep the abbrevations like "ar" means "as required" and "in" means inch, where as it is highlight all ar letters where ever it is finding, from the word argument it is highlighting ar and in from instructions first two letters, Kindly help me in this regard. Quote:
|
#14
|
|||
|
|||
search for whole word means should check for before and after space
Dear All,
As below code i am able to search for the words existing in the table, but it is not checking as a whole in active document. example: if i keep the abbrevations like "ar" means "as required" and "in" means inch, where as it is highlight all ar letters where ever it is finding, from the word argument it is highlighting ar and in from instructions first two letters, Kindly help me in this regard. Quote: Originally Posted by gmayor View Post Create a document with a single column table. Put one of the phrases in each cell (no blanks) save the document then put the name and path in the following macro in place of "C:\Path\Table.docx". Run the macro on your document with the phrases. Code: Sub Highlighting() Dim oChanges As Document, oDoc As Document Dim oTable As Table Dim oCell As Cell Dim oRng As Range Dim rFindText As Range Const sFname As String = "C:\Path\Table.docx" Set oDoc = ActiveDocument Set oChanges = Documents.Open(Filename:=sFname, Visible:=False) Set oTable = oChanges.Tables(1) For Each oCell In oTable.Range.Cells If Len(oCell.Range) > 2 Then Set oRng = oDoc.Range Set rFindText = oCell.Range rFindText.End = rFindText.End - 1 With oRng.Find .ClearFormatting .Replacement.ClearFormatting Do While .Execute(FindText:=rFindText, _ MatchWholeWord:=True) = True oRng.HighlightColorIndex = wdBrightGreen Loop End With End If Next oCell lbl_Exit: oChanges.Close 0 Set oChanges = Nothing Set oDoc = Nothing Set oRng = Nothing Set rFindText = Nothing Exit Sub End Sub |
#15
|
||||
|
||||
Well, of course it does. There is no way Word can tell whether 'ar' or 'in' is an abbreviation. You would reduce the risk of false matches if your abbreviations followed the convention of incorporating periods in them (e.g. 'a.r.' or 'in.') and included the period(s) as part of the Find text, but even that won't stop 'in.' for example being matched here:
I found a bin to put it in.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search for italicized words | ep2002 | Word | 4 | 11-10-2014 10:23 PM |
Macro to Search for all words with (R) and place in new document | kd12 | Word VBA | 2 | 06-10-2014 02:25 PM |
How to search for 2 words at the same time | mrayncrental | Word VBA | 1 | 06-08-2014 03:08 AM |
Multiple words, one search | return2300 | Word VBA | 0 | 08-30-2013 12:26 PM |
Search for words starting in capitals | surreytom | Word VBA | 3 | 04-01-2012 01:41 AM |