Question Put strikethrough text between brackets in a Word Document

pablormago

New member
Joined
Apr 12, 2013
Messages
1
Programming Experience
5-10
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 "[]":



VB.NET:
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 = True 
newWord.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...
 
Back
Top