2017-03-19 3 views
0

모양 개체 특정 문자열을 검색하고 변경 후 다른 문자열로 바꾸겠습니다. 끝 줄에 한 줄 더 추가하고 싶습니다.모양 개체의 줄 끝 부분에 문자열을 추가하십시오.

첫 번째 부분으로

(검색 문자열과 교체는) 내가 사용 :

set oShape = ActiveDocument.Shapes(indexShape).TextFrame.TextRange 
With oShape.find 
    .ClearFormatting 
    .Text = i_wordToFind 
    .Replacement.ClearFormatting 
    .Replacement.Text = i_ValueResponsible 
    .MatchWholeWord = True 
    .Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindStop 
End With 

어떻게 내가 문자열을 찾아 그 라인의 마지막에 문자열을 추가 할 수 있습니까? 그것은 단지의 첫 번째 항목에 i_WordToFind을 대체하지만

감사, 탈

답변

0

이 당신을 위해 일을해야한다.

Private Sub InputTal() 

    Dim oShape As Shape 
    Dim Rng As Range 

    Set oShape = ActiveDocument.Shapes(indexShape) 
    Set Rng = oShape.TextFrame.TextRange 
    Rng.Find.Execute FindText:=i_WordToFind, Forward:=True 
    If Rng.Find.Found Then 
     With Rng 
      .Text = i_ValueResponsible 
      .MoveUntil Cset:=Chr(11) & Chr(13) 
      .Text = " " & i_ValueResponsible 
     End With 
    End If 
End Sub 
관련 문제