2017-03-26 3 views
0

Word 문서의 "이 메모에 회신하십시오"줄을 모두 자동으로 삭제하는 매크로를 작성하려고합니다."이 메모에 회신하기"줄을 삭제하십시오. Word

전체 줄 (단락 기호 포함)을 찾기 - 바꾸기 방법을 알 수 없습니다.

단락 기호의 ASCII 코드는^013입니다.

원본 텍스트는 일반적으로 블로그 게시물에서 아래처럼 Word로 복사됩니다.

enter image description here

+0

doc라는 단어의 이미지를 표시하거나 공유 할 수 있습니까? – 0m3r

+0

"특수 문자 https://www.extendoffice.com/documents/word/661-replace-hard-returns-with-soft-returns.html#a1에 나열된이 댓글에 대한 답장^p'" – Slai

+0

@ Slai - 그게 내가 시도한 첫 번째 일이고 작동하지 않았다. 오류 대화 상자가 나타나서 "Word 문서 검색이 끝났습니다. 검색 항목을 찾을 수 없습니다. "^ p는 자체적으로 작동하지만 다른 텍스트와 함께 작동하지 않습니다. –

답변

1

솔루션은 아래와 같다. 문구를 계산 한 다음 문구와 단락 기호를 삭제하면서 텍스트를 반복합니다.

Sub DeleteReplyComments() 
    ' loop through lines to count Replies 
    Selection.Find.ClearFormatting 
    MyDoc = ActiveDocument.Range.Text 
    txt = "Reply to this comment" 
    t = Replace(MyDoc, txt, "") 
    nCount = (Len(MyDoc) - Len(t))/Len(txt) 
    ' delete Replies and ^p's 
    For i = 1 To nCount 
     With Selection.Find 
      .Text = "Reply to this comment" 
      .Replacement.Text = "" 
      .Forward = True 
      .Wrap = wdFindContinue 
      .Format = False 
      .MatchCase = False 
      .MatchWholeWord = False 
      .MatchWildcards = False 
      .MatchSoundsLike = False 
      .MatchAllWordForms = False 
     End With 
     Selection.Find.Execute 
     Selection.MoveEnd Unit:=wdParagraph 
     Selection.Delete Unit:=wdCharacter, Count:=1 
    Next i 
End Sub