메인 컨텐츠로 가기

여러 파일을 단어로 검색하고 바꾸는 방법은 무엇입니까?

동일한 콘텐츠 (예 : 머리글, 바닥 글, 일부 특수 단어 또는 숫자)가 포함 된 수십 개의 단어 파일이 있고 Word의 해당 문서에서 동일한 콘텐츠를 바꿔야하는 경우. 신속하게 처리하는 것이 얼마나 쉬울까요? 물론 해당 파일을 하나씩 열어 동일한 콘텐츠를 바꿀 수 있지만 시간이 많이 걸리고 번거로울 것입니다. 이 자습서는 Word의 여러 문서에서 동일한 콘텐츠를 한 번에 바꾸는 까다로운 방법을 보여줍니다.

VBA 코드를 사용하여 여러 단어 문서에서 텍스트를 동시에 찾고 바꿉니다.
Word 용 Kutools를 사용하여 여러 문서에서 동시에 다른 텍스트를 쉽게 찾고 바꿀 수 있습니다.


VBA 코드를 사용하여 여러 단어 문서에서 텍스트를 동시에 찾고 바꿉니다.

1. 프레스 다른 + F11 를 열려면 응용 프로그램 용 Microsoft Visual Basic 창.

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창을 클릭합니다 끼워 넣다모듈을 클릭 한 다음 다음 VBA 코드를 모듈 창에 복사합니다.

VBA 코드 : 한 번에 여러 문서에서 동일한 콘텐츠 검색 및 교체

Sub CommandButton1_Click()
'Updated by Extendoffice 20180625
Dim xFileDialog As FileDialog, GetStr(1 To 100) As String '100 files is the maximum applying this code
Dim xFindStr As String
Dim xReplaceStr As String
Dim xDoc As Document
On Error Resume Next
Set xFileDialog = Application.FileDialog(msoFileDialogFilePicker)
With xFileDialog
    .Filters.Clear
    .Filters.Add "All WORD File ", "*.docx", 1
    .AllowMultiSelect = True
    i = 1
    If .Show = -1 Then
        For Each stiSelectedItem In .SelectedItems
            GetStr(i) = stiSelectedItem
            i = i + 1
        Next
        i = i - 1
    End If
    Application.ScreenUpdating = False
    xFindStr = InputBox("Find what:", "Kutools for Word", xFindStr)
    xReplaceStr = InputBox("Replace with:", "Kutools for Word", xReplaceStr)
    For j = 1 To i Step 1
        Set xDoc = Documents.Open(FileName:=GetStr(j), Visible:=True)
        Windows(GetStr(j)).Activate
        Selection.Find.ClearFormatting
        Selection.Find.Replacement.ClearFormatting
        With Selection.Find
            .Text = xFindStr  'Find What
            .Replacement.Text = xReplaceStr  'Replace With
            .Forward = True
            .Wrap = wdFindAsk
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchByte = True
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
        Application.Run macroname:="NEWMACROS"
        ActiveDocument.Save
        ActiveWindow.Close
    Next
    Application.ScreenUpdating = True
End With
MsgBox "Operation end, please view", vbInformation
End Sub

3. 누르세요 F5 코드를 실행하는 키입니다.

4. 오프닝에서 검색 창에서 찾을 문서를 찾아 선택하고 내부 텍스트를 바꾼 다음 OK 단추. 스크린 샷보기 :

5. 첫 번째 Word 용 Kutools 대화 상자에서 문서에서 찾을 텍스트를 무엇을 찾기 상자를 클릭 한 다음 OK 버튼을 클릭합니다.

6. 두 번째 Word 용 Kutools 대화 상자에서 바꿀 텍스트를 입력하고 OK 버튼을 클릭합니다.

8. 을 클릭합니다 OK 다음 버튼 마이크로 소프트 워드 대화 상자에서 찾기 및 바꾸기를 완료합니다.

이 경우 선택한 문서의 모든 단어 "Word"가 동시에 "Excel"로 대체됩니다.


Word 용 Kutools를 사용하여 여러 문서에서 동시에 다른 텍스트를 쉽게 찾고 바꿀 수 있습니다.

여기에 적극 추천합니다 일괄 찾기 및 바꾸기 특징 Word 용 Kutools. 이 기능을 사용하면 여러 Word 문서에서 동시에 다른 텍스트를 쉽게 찾고 바꿀 수 있습니다. 이 기능을 적용하여 문서에서 텍스트를 찾고 바꾸는 방법을 살펴 보겠습니다.

Word 용 Kutools : 100 개 이상의 편리한 Word 추가 기능으로 제한 없이 자유롭게 시도 60.

1. 클릭하십시오 쿠툴즈 플러스 > 일괄 찾기 및 바꾸기 이 기능을 사용하려면

2. 에서 일괄 찾기 및 바꾸기 대화 상자에서 다음과 같이 구성하십시오.

  • 2.1) 클릭 행 추가 버튼 아래에 찾기 및 바꾸기 탭;
  • 2.2) 생성 된 행 필드에서 :
A. 텍스트 상자에 찾을 텍스트를 입력하십시오. Find 칼럼
B. 텍스트 상자에 바꿀 텍스트를 입력합니다. 교체 기둥;
C. 검색 유형, 텍스트를 찾을 위치 및 필요에 따라 텍스트를 강조 표시 할 색상을 지정합니다. 이 경우에는 전체 단어 일치, 주요 문서 그리고에서 특정 색상 검색 유형, 에서 찾기강조 열;
  • 2.3) 2.1 단계와 2.2 단계를 반복하여 찾고 바꿀 텍스트를 더 추가합니다.
  • 2.4) 클릭  버튼의 파일 형식 섹션에서 텍스트를 찾고 바꿀 Word 문서를 추가합니다.
  • 2.5) 클릭 교체 or Find 단추. 스크린 샷보기 :

노트:
1. 클릭하면 Find 버튼을 누르면 모든 검색 결과가 아래에 표시됩니다. 미리보기 결과 탭. 결과를 미리 본 후 모든 텍스트를 바꾸려면 찾기 및 바꾸기 탭. 그렇지 않으면 대화 상자를 닫으십시오.

2. 클릭하면 교체 버튼을 클릭하면 지정된 모든 텍스트가 즉시 새 텍스트로 대체되고 결과도 아래에 표시됩니다. 미리보기 결과 탭.

3. 2 단계에서 강조 색상을 지정하면 대체 된 모든 텍스트가 지정된 색상으로 강조 표시되며 문서에서 쉽게 찾을 수 있습니다.

3. 닫기 일괄 찾기 및 바꾸기 대화 상자

이 기능에 대한 자세한 내용은 여기를 클릭하세요 ....

이 유틸리티의 무료 평가판을 받으려면 다음으로 이동하십시오. 소프트웨어 무료 다운로드 먼저 위의 단계에 따라 작업을 적용하십시오.

최고의 사무 생산성 도구

Word 용 Kutools - Over로 단어 경험을 향상시키세요 100 놀라운 기능!

🤖 Kutools AI 도우미: AI로 글쓰기를 변화시키세요 - 콘텐츠 생성  /  텍스트 다시 쓰기  /  문서 요약  /  정보 문의 문서 기반, 모두 Word 내에서

📘 문서 숙달: 페이지 분할  /  문서 병합  /  다양한 형식으로 선택 항목 내보내기(PDF/TXT/DOC/HTML...)  /  PDF로 일괄 변환  /  페이지를 이미지로 내보내기  /  한 번에 여러 파일 인쇄...

컨텐츠 편집: 일괄 찾기 및 바꾸기 여러 파일에 걸쳐  /  모든 사진 크기 조정  /  테이블 행과 열 바꾸기  /  표를 텍스트로 변환...

🧹 손쉬운 청소: 쓸어버리다 추가 공간  /  섹션 나누기  /  모든 헤더  /  텍스트 상자  /  하이퍼 링크  / 더 많은 제거 도구를 보려면 다음 페이지를 방문하세요. 그룹 제거...

광고 삽입물: 삽입 천 단위 구분 기호  /  확인란  /  라디오 버튼  /  QR 코드  /  바코드  /  대각선 표  /  방정식 캡션  /  이미지 캡션  /  테이블 캡션  /  여러 장의 사진  / 더 자세히 알아보세요. 그룹 삽입...

🔍 정밀한 선택: 핀포인트 특정 페이지  /  테이블  /  모양  /  제목 단락  / 탐색 기능 향상 배우기 기능 선택...

스타 강화: 어떤 위치로든 빠르게 이동  /  반복되는 텍스트 자동 삽입  /  문서 창 간을 원활하게 전환합니다.  /  11 변환 도구...

👉 이러한 기능을 사용해 보고 싶으신가요? Word 용 Kutools는 다음을 제공합니다. 60 일 무료 사용, 제한 없음! 🚀
 
Comments (70)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
thanks for -How To Search And Replace Across Multiple Files In Word?

what about from out side (by folder) ?

thanks gain
This comment was minimized by the moderator on the site
This is a great explanation.  Is there a way to change settings, e.g. page size, simultaneously? 
This comment was minimized by the moderator on the site
After pressing F5, I get the following error" "Compile error: User-defined type not defined." Can someone help?
This comment was minimized by the moderator on the site
Hi Monique,Please check if the Microsoft Office Object Library is enabled as shown in the screenshot below.
This comment was minimized by the moderator on the site
This is SUCH a time saving solution. THANK YOU!
One thing that may make it even better, is adding support for subdirectories. (That is: Files in multiple subdirectories)
I am an absolute newbie in this, and don't know the syntax, the parameter, or where to add that.

Could somebody help?
This comment was minimized by the moderator on the site
I need to replace text in multiple Word files and have the replaced text highlighted. Is there a way to do this?
This comment was minimized by the moderator on the site
Hi Daphne,
Why not try the Batch Find and Replace feature of Kutools for Word? It can solve this issue with ease.
This comment was minimized by the moderator on the site
this was a lifesaver thank you so much
This comment was minimized by the moderator on the site
Is it possible to replace in the headers of the word doc?
This comment was minimized by the moderator on the site
Hi Tiago,
Please apply the below VBA code to include the content of headers and footers when finding and replacing texts in multiple documents at once.

Sub CommandButton1_Click()
'Updated by Extendoffice 20180625
Dim xFileDialog As FileDialog, GetStr(1 To 100) As String '100 files is the maximum applying this code
Dim xFindStr As String
Dim xReplaceStr As String
Dim xDoc As Document
On Error Resume Next
Set xFileDialog = Application.FileDialog(msoFileDialogFilePicker)
With xFileDialog
.Filters.Clear
.Filters.Add "All WORD File ", "*.docx", 1
.AllowMultiSelect = True
i = 1
If .Show = -1 Then
For Each stiSelectedItem In .SelectedItems
GetStr(i) = stiSelectedItem
i = i + 1
Next
i = i - 1
End If
Application.ScreenUpdating = False
xFindStr = InputBox("Find what:", "Kutools for Word", xFindStr)
xReplaceStr = InputBox("Replace with:", "Kutools for Word", xReplaceStr)
For j = 1 To i Step 1
Set xDoc = Documents.Open(FileName:=GetStr(j), Visible:=True)
Windows(GetStr(j)).Activate
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = xFindStr 'Find What
.Replacement.Text = xReplaceStr 'Replace With
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run macroname:="NEWMACROS"
If MsgBox("Do you want to replace texts in headers and footers too? ", vbYesNo, "Kutools for Word") = vbYes Then
ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run macroname:="NEWMACROS"
ActiveWindow.View.SplitSpecial = wdPanePrimaryHeader
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run macroname:="NEWMACROS"
End If
ActiveDocument.Save
ActiveWindow.Close
Next
Application.ScreenUpdating = True
End With
MsgBox "Operation end, please view", vbInformation
End Sub
This comment was minimized by the moderator on the site
Is that possible to replace in the header of the word doc?
This comment was minimized by the moderator on the site
Thanks for sharing this information with us.
Word search and replace tool
This comment was minimized by the moderator on the site
Works perfectly but is there a similar macro to change text in the header! because this does not work with this version!
thanks
This comment was minimized by the moderator on the site
Hi,
Please apply the below VBA code to include the content of headers and footers when finding and replacing texts in multiple documents at once.

Sub CommandButton1_Click()
'Updated by Extendoffice 20180625
Dim xFileDialog As FileDialog, GetStr(1 To 100) As String '100 files is the maximum applying this code
Dim xFindStr As String
Dim xReplaceStr As String
Dim xDoc As Document
On Error Resume Next
Set xFileDialog = Application.FileDialog(msoFileDialogFilePicker)
With xFileDialog
.Filters.Clear
.Filters.Add "All WORD File ", "*.docx", 1
.AllowMultiSelect = True
i = 1
If .Show = -1 Then
For Each stiSelectedItem In .SelectedItems
GetStr(i) = stiSelectedItem
i = i + 1
Next
i = i - 1
End If
Application.ScreenUpdating = False
xFindStr = InputBox("Find what:", "Kutools for Word", xFindStr)
xReplaceStr = InputBox("Replace with:", "Kutools for Word", xReplaceStr)
For j = 1 To i Step 1
Set xDoc = Documents.Open(FileName:=GetStr(j), Visible:=True)
Windows(GetStr(j)).Activate
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = xFindStr 'Find What
.Replacement.Text = xReplaceStr 'Replace With
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run macroname:="NEWMACROS"
If MsgBox("Do you want to replace texts in headers and footers too? ", vbYesNo, "Kutools for Word") = vbYes Then
ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run macroname:="NEWMACROS"
ActiveWindow.View.SplitSpecial = wdPanePrimaryHeader
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run macroname:="NEWMACROS"
End If
ActiveDocument.Save
ActiveWindow.Close
Next
Application.ScreenUpdating = True
End With
MsgBox "Operation end, please view", vbInformation
End Sub
This comment was minimized by the moderator on the site
Oh yeah! Thank you sooooo much! This is a life-saver!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations