Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 07-24-2019, 11:32 AM   #1
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
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
Unfortunately, it works, as I understood, for so called curly quotes. I'm working preferably with double angle quotation marks (»...«), Chr (187) resp. Chr (171). Whatever I tried, but I didn't get the macro working for this.
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.
Leonatus is offline   Reply With Quote
Old 07-25-2019, 04:31 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
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
to:

Code:
            If Mid(sRaw, J, 1) = Chr(187) Then
                iSmart = iSmart + 1
            End If
            If Mid(sRaw, J, 1) = Chr(171) Then
for guillemets (»...«)?
Doitsu is offline   Reply With Quote
Advert
Old 07-25-2019, 04:41 AM   #3
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
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.
Leonatus is offline   Reply With Quote
Old 07-25-2019, 05:03 AM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,727
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Leonatus View Post
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.
That section searches for dumb quotes ("...") and shouldn't have any effect on the following section. Maybe there's a problem with MS Word.

Try the modified macro on the machine that works with Toxaris's tool.
Doitsu is offline   Reply With Quote
Old 07-25-2019, 07:23 AM   #5
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,055
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by Doitsu View Post
Try the modified macro on the machine that works with Toxaris's tool.
Hm, that's what I did all the time. Did you try to apply the macro?
Leonatus is offline   Reply With Quote
Advert
Old 07-25-2019, 07:19 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
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
BetterRed is offline   Reply With Quote
Old 07-26-2019, 01:54 AM   #7
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
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
Leonatus is offline   Reply With Quote
Old 07-29-2019, 03:37 AM   #8
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
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.
Leonatus is offline   Reply With Quote
Old 07-29-2019, 04:23 AM   #9
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
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.
BetterRed is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 02:04 PM.


MobileRead.com is a privately owned, operated and funded community.