![]() |
#5
|
|||
|
|||
![]()
There's always a niggle.
I cut and pasted the test text back into my word document to ensure that the smart quotes came out right. As a consequence I had two copies of the text in my document. The code then promptly fell over as I'd forgotten to add a test for duplicate definitions. You will need to replace the subroutine below in place of the equivalent subroutine in the code I initially provided. Code:
Sub do_actions_for_quoted_text(this_range As Word.range) ' Check to see if a definition we have just found already exists If quoted_definitions.Exists(this_range.text) Then search_doc.Comments.Add range:=this_range, text:="Duplicate definition?" Exit Sub End If If Not this_range.Next(unit:=wdCharacter).text = close_smart_quote Then ' comment out the line below if you don't want comments in the document search_doc.Comments.Add range:=this_range.Duplicate, text:="Missing closing quote" ' Uncomment the next line to add a closing smart quote if one is missing. ' this_range.InsertAfter text:=close_smart_quote End If quoted_definitions.Add key:=this_range.text, Item:=True End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
thejollyroger | Word VBA | 14 | 12-04-2017 09:00 AM |
![]() |
jhy001 | Word | 4 | 11-06-2017 02:08 PM |
![]() |
LadyAna | Word | 1 | 12-06-2014 10:39 PM |
Wild card to highlight capitalised terms? | bertietheblue | Word | 2 | 02-08-2013 04:44 PM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |