Byl jsem pomocí následující makro vytáhnout položky v závorkách na komentáře v aplikaci word:
'
' CommentBubble Macro
'
'
Dim myRange As Range
Set myRange = ActiveDocument.Content
searchtext = "\(*\)"
With myRange.Find
.MatchWildcards = True
Do While .Execute(findText:=searchtext, Forward:=True) = True
If Len(myRange.Text) > 4 Then
ActiveDocument.Comments.Add myRange, myRange.Text
myRange.Text = ""
End If
Loop
End With
End Sub
Důvod, proč jsem délce textu být > 4 je, protože tyto jsou právní dokumenty, a nechci se izolovat řetězce, které mají věci jako "za následujících podmínek: (i) podmínku 1, (ii) podmínka 2, atd."
Nicméně, zde je úryvek z textu, pro které výše uvedený kód přestávky:
This is sample text (with some additional text) that does stuff (with more stuff) and represents 39.4% of shares on the effective date (before giving effect, with some conditions such as ( some stuff (i) and some stuff (ii) with final stuff) and more final stuff) which is subject to (some conditions here) and conclude here.
Pokud spustíte tuto získáte následující výsledek:
This is sample text that does stuff and represents 39.4% of shares on the effective date and some stuff (ii) with final stuff) and more final stuff) which is subject to and conclude here.
Jak můžete vidět vnořené závorky způsobit nějaké potíže. Nějaké rady?
Díky!!!