#1
|
|||
|
|||
Can't search for---
My 500+ page WORD 2003 document has 40-50 examples of 3 dashes --- following a tab.
Searching for --- turns up nothing as does tab code--- I have tried shutting down and restarting my WORD 2007 with no luck. How can I do this search? Last edited by billob; 09-24-2016 at 09:40 PM. Reason: Left out version |
#2
|
||||
|
||||
That really depends on what types of dashes you're working with. Some of these might superficially look the same:
- − ― – — but they actually consist of a: • hyphen • minus sign • horizontal bar • en-dash • em-dash To cater for all these possibilities you could use a wildcard Find, where: Find = ^t[\-\−\―\–\—]{3}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Paul:
Thank you for your response. This is absolutely crazy! Sorry to say, I could not make what you sent work. Today my Find --- (the the lower half of the underscore key) works just fine like I thought it should have in the first place. Now for the toughie? I have several thousand lines with "several words in between" Always on one line. How can I find lines that have only one " ? |
#4
|
||||
|
||||
As indicated in my previous post the expression is for a wildcard Find. Did you check the use wildcards option?
Quote:
Code:
Sub TestQuotes() Dim oPara As Paragraph For Each oPara In ActiveDocument.Paragraphs With oPara.Range If (Len(.Text) - Len(Replace(.Text, Chr(34), vbNullString))) Mod 2 <> 0 Then .Select MsgBox "Selected paragraph has unmatched plain quotes", vbExclamation Exit Sub End If If Len(Replace(.Text, Chr(147), vbNullString)) <> Len(Replace(.Text, Chr(148), vbNullString)) Then .Select MsgBox "Selected paragraph has unmatched smart quotes", vbExclamation Exit Sub End If End With Next End Sub For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hi Paul:
Thanks again for your help. Yes, The wildcard box was the first thing I checked for when it did not work. That said, it worked perfectly today. I have been using this Find function for umpteen years and it has always had a way of sometimes not finding something I know is there. When this happens, I test by asking it to find any alpha or numeric character that I am currently viewing and if it comes up 'no find' I shut down Word and then reboot. If I simply restart Word, when I click find, the last thing I searched for will still be there, Hence the Reboot. Having never used Word's Macro thing I'll have to give it a try. Many years ago I was fairly successful with Excel Macros. Cheers, Billob |
#6
|
|||
|
|||
Hi Paul:
I can get the macro to run until it's first 'hit' occurs. This example has it's " on two different lines which in this case is OK. The problem is I can't get the macro to go any farther unless I fix this condition. How do I get the macro to skip over this 'hit' and continue on? Best regards, Billob |
#7
|
||||
|
||||
Quote:
ActiveDocument to: Selection or, to work from there to the end of the document, change: ActiveDocument.Paragraphs to: ActiveDocument.Range(Selection.Start, ActiveDocument.Range.End).Paragraphs
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Hi Paul:
Thanks again. I tried both approaches, one at a time with no change whatsoever in the result. The macro stops at and highlights the first hit and will go no farther. A message tells me that the macro found an unpaired quote. Since you mentioned 'selection', I also tried clicking 'select all' prior to launching the Macro but that did not work as when the macro highlights the first hit, the 'select all' highlighting goes away as I expected it would. Am I not understanding what you mean by 'selection'? If I could chose my starting points I could fix the hits that are bad and jump over the hits that are OK as is and continue on. If it could be made to highlight all 'hits', that would work but every time I fix a highlighted hit, all of the other highlights would probably go away and I would have to run the macro again to re highlight them but I could still do the job. Any Ideas will be appreciated. For the most part what I am trying to find is one line two or three word name like "Cox Babe Bee" or Fox .59" with one of it's quotes missing or being an incorrect character. Best regards, Billob |
#9
|
||||
|
||||
Both revisions work as specified. The: first one requires you to select the range you want to test; second one requires only that you position the insertion point where you want the macro to start testing from. In either case, the macro will exit at the first mismatched paragraph in the specified range. I don't know what could be simpler.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Hi Paul:
I think I now understand what you are trying to say and will try later, hopefully tonight. Is there anyway short of creating the whole macro again that I can assign a shortcut key to it? Best regards, Billob |
#11
|
||||
|
||||
If you copy & paste the macro into a code module attached to Word's 'Normal' template, it will be available for use with all documents. There is no need to recreate the macro each time; If Word prompts you to save the template changes, let it do so. That said, you can also assign macros to keyboard shortcuts. See: http://word.mvps.org/faqs/customizat...roToHotkey.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Hi Paul:
The macro is now doing what I need it to do. Thank you very much for the assistance. Best Regards, Billob |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Use CSV as search criteria for Outlook search folder | lonesoac0 | Outlook | 0 | 03-07-2016 02:31 PM |
Onenote 2013 search is not identifying search terms correctly | Delta223 | OneNote | 0 | 08-12-2014 06:40 AM |
Search for date and then apply mutliple search criteria in huge dataset | maxtymo | Excel | 2 | 12-01-2013 04:52 AM |
Looking for Windows Search app with ability to search by content | gopher_everett | Office | 1 | 02-28-2013 09:23 PM |
Search and Replace - Clear Search box | JostClan | Word | 1 | 05-04-2010 08:46 PM |