Word'deki yorumlara parantez içindeki öğeleri çıkarmak için aşağıdaki makroyu kullanıyorum:
'
' 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
Metnin uzunluğunun > 4 olmasının nedeni, bunların yasal belgeler olması ve aşağıdaki koşullarda "gibi şeylere sahip dizeleri izole etmek istemem: (i) koşul 1, (ii) koşul 2, vb."
Ancak, yukarıdaki kodun kırıldığı bir metin parçası:
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.
Bunu çalıştırırsanız, aşağıdaki sonucu alırsınız:
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.
Gördüğünüz gibi, iç içe geçmiş parantezler bazı sorunlara neden oluyor. Herhangi bir tavsiye?
Teşekkürler!