Checking quotes consistency Wordfast Classic

From Wordfast Wiki
Jump to: navigation, search

The following macro compares source/target segment to make sure quotes are consistent (same types and numbers of quotes used). Add this macro to WFC/Setup/General, as a QA macro, or as a Post-segmentation macro.

When a quote discrepancy is found, WFC will warn the user, with a choice of getting back to the segment and correcting the problem, or just moving on to the next segment.

Sub CheckQuotes()

If Not ActiveDocument.Bookmarks.Exists("WfSource") Then Exit Sub

Dim I As Integer, Src As String, Trg As String, Quotes As String, Uq As String

Quotes = Chr(34) + Chr(171) + Chr(187) + Chr(147) + Chr(148)

Src = ActiveDocument.Bookmarks("WfSource").Range.Text

Trg = ActiveDocument.Bookmarks("WfTarget").Range.Text

For I = 1 To Len(Quotes)

Uq = Mid(Quotes, I, 1)

If (InStr(Src, Uq) > 0 And InStr(Trg, Uq) = 0) Or (InStr(Src, Uq) = 0 And InStr(Trg, Uq) > 0) Then

If MsgBox("Possible problem with quotes (" + Uq + ".) Fix it?", vbYesNo, "Wordfast") = vbYes Then

Selection.Bookmarks.Add "WfStop"

End If

Exit Sub

Else

If InStr(Src, Uq) > 0 Or InStr(Trg, Uq) > 0 Then

If InStr(Src, Uq) > 0 Then Mid(Src, InStr(Src, Uq), 1) = "*"

If InStr(Trg, Uq) > 0 Then Mid(Trg, InStr(Trg, Uq), 1) = "*"

I = I - 1

End If

End If

Next

End Sub

Back to Wordfast Classic User Manual