Put strikethrough text between brackets in a Word Document

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi to all, i have a little problem, i need to find text formated in strikethrough and put in between brackets.


The following code can replace every character in strikethrough by an "*" but i need the found text to be between brackets "[]":


Dim newWord As Word.Application = Nothing Dim newDocs As Word.Documents = Nothing Dim newDoc As Word.Document = Nothing newWord = New Word.Application() newDocs = newWord.Documents newDoc = newDocs.Open("C:Prueba.doc") newDoc.Range.Tables(1).Columns(2).Select() newWord.Selection.Find.ClearFormatting() newWord.Selection.Find.Font.StrikeThrough = TruenewWord.Selection.Find.Replacement.ClearFormatting() With newWord.Selection.Find .Text = "*" .Replacement.Text = "[" & .Text &"]" .Forward = True .Wrap = Word.WdFindWrap.wdFindContinue .Format = True .MatchWildcards = True End With newWord.Selection.Find.Execute(Replace:=Word.WdReplace.wdReplaceAll) newDoc.SaveAs("C:Prueba.doc") newDoc.Close() newWord.Quit()
Can anybody help me please???
Thanks in advance...

View the full article
 
Back
Top