![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,055
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
|
Word macro to check missing quotation marks
Usually, I apply Toxaris' "Check Dialogue" tool to check for missing Quotation marks. That is really great - when it works. Unfortunately, on one of my Computers it doesn't work at all for doubtful reasons. So, I thought by myself, it would be good to have a Word macro that could do this.
In the Internet, I found one that highlights all paragraphs with mismatching Quotation marks. It is this one: Code:
Sub MarkUnevenQuotes() Dim sRaw As String Dim iNorm As Integer Dim iSmart As Integer Dim J As Long Selection.HomeKey Unit:=wdStory Application.ScreenUpdating = False Selection.Find.ClearFormatting With Selection.Find .Text = """" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute While Selection.Find.Found Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend sRaw = Selection.Text iNorm = 0 iSmart = 0 For J = 1 To Len(sRaw) If Mid(sRaw, J, 1) = Chr(34) Then If iNorm > 0 Then iNorm = iNorm - 1 Else iNorm = iNorm + 1 End If End If If Mid(sRaw, J, 1) = Chr(147) Then iSmart = iSmart + 1 End If If Mid(sRaw, J, 1) = Chr(148) Then iSmart = iSmart - 1 End If Next J If iNorm > 0 Or iSmart > 0 Then Selection.Range.HighlightColorIndex = wdYellow End If Selection.Collapse Direction:=wdCollapseEnd Selection.Find.Execute Wend Selection.HomeKey Unit:=wdStory Application.ScreenUpdating = True End Sub As I'm no technician, it would be of no sense to study programming VBA only for this purpose. Is there Perhaps someone who could provide us with a suiting macro of this sort? That would be very helpful. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,727
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
Have you tried changing the following section:
Code:
If Mid(sRaw, J, 1) = Chr(147) Then iSmart = iSmart + 1 End If If Mid(sRaw, J, 1) = Chr(148) Then Code:
If Mid(sRaw, J, 1) = Chr(187) Then iSmart = iSmart + 1 End If If Mid(sRaw, J, 1) = Chr(171) Then |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,055
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
|
Yes, that has been my initial reasoning, but it didn't work. I thought it had probably to do with the Chr(34) in
Code:
If Mid(sRaw, J, 1) = Chr(34) Then If iNorm > 0 Then iNorm = iNorm - 1 Else iNorm = iNorm + 1 End If but I didn't find a way out. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,727
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Try the modified macro on the machine that works with Toxaris's tool. |
|
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,055
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@Leonatus - the Transtools add-in has some macro's referring to "Frenchdoublequotes". Unfortunately they're 'protected' so you can't Edit or Step through them - but I've found the developers to be helpful when responding to emails ==>> Translator Tools / About TransTools suite
BR |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,055
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
|
@BetterRed: Thank you, this could be helpful.
Unfortunately, I seem to have messed up everything. When I created the thread, the macro at least worked in its original form. After trying this and trying that, now nothing works at all, even with the macros still activated and also Windows' Security Center alerts that some apps don't work correctly now (problem could not be identified, but I suppose it was my playing around). I didn't know that Word macros could have such an impact. It seems I better keep my hands off. Last edited by Leonatus; 07-26-2019 at 02:06 AM. Reason: typos |
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,055
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
|
Daring as I am, I tried once more (after veryfiying that the error messages were obviously not due to the word macros), and succeeded in running the macro in the original form. Paragraphs with mismatiching opening or closing " quotation marks were highlighted, such as proposed.
then I changed the macro in the way Doitsu had suggested, and the same paragraphs were highlighted. Those which I had assigned with » or « quotation marks were ignored. That is what had occured in my first trials and why I had created the thread. |
![]() |
![]() |
![]() |
#9 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
wrong
Last edited by BetterRed; 07-29-2019 at 04:26 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Quotation marks missing... | lestatar | Conversion | 2 | 06-11-2011 06:39 AM |
pdf input- all quotation marks missing | plumtoad | Conversion | 7 | 06-01-2011 09:47 PM |
word macro for editing needless paragraph marks | excalibra | Workshop | 6 | 03-12-2011 10:35 AM |
Word Formatting Macro (Stingo's Macro) | Stingo | Sony Reader | 75 | 08-24-2010 05:18 AM |
Please help with quotation marks | Vauh | Calibre | 5 | 04-28-2010 10:15 AM |