Wenk: Ander tale is Google-vertaal. U kan die English weergawe van hierdie skakel.
Teken aan
x
or
x
x
registreer
x

or

Hoe om te soek en te vervang oor verskeie lêers in woord?

As jy 'n paar dosyn woordlêers bevat wat dieselfde inhoud bevat (soos Header, footer, 'n paar spesiale woorde of nommer), en jy moet dieselfde inhoud oor die dokumente in Word vervang. Hoe sal dit makliker wees om dit vinnig te doen? Sekerlik, jy kan die lêers een vir een oopmaak om dieselfde inhoud te vervang, maar dit sal tydrowend en lastig wees. Hierdie handleiding sal jou 'n moeilike manier wys om gelyktydig dieselfde inhoud binne verskeie dokumente in Word te vervang.

Vind en vervang tekste oor verskeie woorddokumente terselfdertyd met VBA-kode


Kombineer / voeg verskeie dokumente in een maklik by:

Die Voeg dokumente saam nut van Kutools for Word kan u help om verskeie dokumente vinnig in een te kombineer. Jy moet net:

  • Kies die dokumente wat u in een sal kombineer.
  • Spesifiseer die breek tussen elke gekombineerde dokument;
  • Begin saamsmelting. Sien skermkiekie:

Kutools for Word: met meer as 100 handige Word-invoegtoepassings, kan u sonder beperking in 30 dae probeer. Laai en gratis toets nou!

Kutools for Word: Voeg 100 nuwe gevorderde funksies by na Word 2003 / 2007 / 2010 / 2013 / 2016 / 2019.
Office Tab: Aktiveer Tabbed redigering en blaai in Office, Net soos Chrome, Firefox, IE 8 / 9 / 10.
Classic Menu for Office: Bring ou blik van kantoor 2003 terug na Office 2007, 2010, 2013, 2016 en 2019.

Vind en vervang tekste oor verskeie woorddokumente terselfdertyd met VBA-kode

1. Press alt + F11 om die Microsoft Visual Basic vir toepassings venster.

2. In die Microsoft Visual Basic vir toepassings venster, kliek Plaas > module, en kopieer dan die volgende VBA-kode na die Module-venster.

VBA-kode: Soek en vervang dieselfde inhoud oor verskeie dokumente op een slag

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. Druk die F5 sleutel om die kode uit te voer.

4. In die opening Kyk na venster, vind asseblief en kies die dokumente wat u sal vind en vervang teks binne, en klik dan op die OK knoppie. Sien skermkiekie:

5. In die eerste Kutools for Word dialoogkassie, voer die teks in wat jy oor dokumente sal vind in die Vind wat boks, en klik dan op die OK knoppie.

6. In die tweede Kutools for Word dialoog, voer die teks in wat u sal vervang, en klik op die OK knoppie.

8. Kliek die OK knoppie in die volgende Microsoft Word dialoogkassie om die soek te voltooi en te vervang.

In hierdie geval word alle woorde "Word" in geselekteerde dokumente terselfdertyd vervang met "Excel".


Office Tab - Tabbed navigeer, redigering en bestuur van verskeie dokumente in Word:

Office Tab bring die oortjie koppelvlak soos gesien in webblaaiers soos Google Chrome, Internet Explorer nuwe weergawes en Firefox na Microsoft Word. Dit sal wees 'n tydbesparende hulpmiddel en onvervangbaar in jou werk. Sien onderstaande demo:

Kliek vir gratis toets van die Office Tab!




Kutools for Word

Meer as 100 Gevorderde funksies vir Word 2003, 2007, 2010, 2013, 2016 en 2019

shot-kutools-700-225-kte

Meer funksies | Gratis aflaai | Slegs $ 39.00 vir honderde funksies

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Tomuko Suryadi · 1 years ago
    What if I want to find and replace multiple sentences in multiple documents?
  • To post as a guest, your comment is unpublished.
    3Cees · 1 years ago
    Thank you so much. You win the internet!

    This has saved me amending 360 documents.

    You're my favourite :)
  • To post as a guest, your comment is unpublished.
    WAK · 1 years ago
    worked like a charm for me. Thanks a billion!
  • To post as a guest, your comment is unpublished.
    CC · 1 years ago
    Merlin 4099, I am having trouble with the following portion of your code. I am new to VBA.:

    ' --------------- --------------- --------------- ----------
    ' Beginning Header Updates
    ' --------------- --------------- --------------- ----------
    Windows(GetStr(j)).Activate
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.Cle arFormatting

    If ActiveWindow.View.SplitSpecialwdPane None Then
    ActiveWindow.Panes(2).Close
    End If

    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View .Type = wdOutlineView Then

    Can anyone help me? I think I fixed most
    • To post as a guest, your comment is unpublished.
      blue_crayon · 1 years ago
      Was figuring out this issue myself, today.

      First, make sure you fix the line:

      Selection.Find.Replacement.Cle arFormatting

      To be:

      Selection.Find.Replacement.ClearFormatting

      Then, change the following line:

      If ActiveWindow.View.SplitSpecialwdPane None Then

      To look like this:

      If ActiveWindow.View.SplitSpecial <> wdPaneNone Then


      The code should look like this in the end:

      Windows(GetStr(j)).Activate
      Selection.Find.ClearFormatting
      Selection.Find.Replacement.ClearFormatting

      If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
      ActiveWindow.Panes(2).Close
      End If

      If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
      ActivePane.View.Type = wdOutlineView Then
      ActiveWindow.ActivePane.View.Type = wdPrintView
      End If
  • To post as a guest, your comment is unpublished.
    CC · 1 years ago
    Merlin4099, I am having trouble with the following portion of your code:

    ' --------------- --------------- --------------- ----------
    ' Beginning Header Updates
    ' --------------- --------------- --------------- ----------
    Windows(GetStr(j)).Activate
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.Cle arFormatting

    If ActiveWindow.View.SplitSpecialwdPane None Then
    ActiveWindow.Panes(2).Close
    End If

    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View .Type = wdOutlineView Then

    Can you or anyone else help me?

    Thanks!