Ide: Lòt lang yo se Google-tradui. Ou ka vizite a English vèsyon nan lyen sa a.
Ouvri yon sesyon
x
or
x
x
enskri
x

or

Ki jan nan rechèch ak ranplase atravè dosye miltip nan mo?

Si ou gen plizyè dosye douzèn ki gen ladan kontni an menm (tankou Header, pye, kèk mo espesyal oswa nimewo), epi ou bezwen ranplase kontni an menm atravè dokiman sa yo nan Pawòl. Ki jan li ta pi fasil pou ou jwenn li fè byen vit? Sètènman, ou ka louvri sa yo dosye youn pa youn ranplase kontni an menm, men li pral tan konsome ak anbarasman. Tutorial sa a pral montre w yon fason difisil ranplase menm kontni nan dokiman miltip nan Pawòl nan yon fwa.

Chache epi ranplase tèks atravè dokiman mo miltip an menm tan avèk kòd VBA


Konbine / rantre plizyè dokiman nan yon sèl fasil:

Jounal Rantre Dokiman yo sèvis piblik nan Kutools pou Pawòl ka ede ou konbine dokiman miltip nan yon sèl byen vit. Ou jis bezwen:

  • Chwazi dokiman ou pral konbine nan yon sèl;
  • Espesifye repo ant chak dokiman konbine;
  • Kòmanse fizyon. Al gade nan Ekran:

Kutools pou Pawòl: ak plis pase 100 sou la men Pawòl ajoute-ins, gratis eseye pa gen okenn limit nan jou 30. Download ak gratis jijman Koulye a!

Kutools pou Pawòl: Add 100 nouvo karakteristik avanse pou Pawòl 2003 / 2007 / 2010 / 2013 / 2016 / 2019.
Biwo Tab: Pèmèt Tabbed Korije ak Navigasyon nan Biwo, Jis tankou Chrome, Firefox, IE 8 / 9 / 10.
Klasik Menu pou Biwo: Pote vye Look nan Biwo 2003 Retounen nan Biwo 2007, 2010, 2013, 2016 ak 2019.

Chache epi ranplase tèks atravè dokiman mo miltip an menm tan avèk kòd VBA

1. Peze Alt + F11 yo louvri a Microsoft Visual Basic pou aplikasyon pou fenèt.

2. Nan Microsoft Visual Basic pou aplikasyon pou fenèt, klike Antre > Modil, Lè sa a, kopye kòd VBA sa yo nan fenèt la modil.

VBA Kòd: Chache ak ranplase menm kontni nan plizyè dokiman nan yon sèl fwa

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. Peze la F5 kle nan kouri kòd la.

4. Nan ouvèti a Browse fenèt, tanpri, jwenn epi chwazi dokiman ou pral jwenn epi ranplase tèks andedan, epi klike sou la OK bouton. Al gade nan Ekran:

5. Nan premye a Kutools pou Pawòl bwat dyalòg, antre nan tèks la ou pral jwenn atravè dokiman nan la jwenn sa bwat, epi klike sou la OK bouton.

6. Nan dezyèm lan Kutools pou Pawòl bwat dyalòg, antre nan tèks la ou pral ranplase ak, epi klike sou la OK bouton.

8. Klike sou la OK bouton nan pwochen an Microsoft Word bwat dyalòg fini fini an epi ranplase.

Nan ka sa a, tout mo "Pawòl" nan dokiman chwazi yo ranplase ak "Excel" an menm tan an.


Biwo Tab - Tabbed Browsing, Korije, ak jere nan Dokiman miltip nan Pawòl:

Tab Biwo pote koòdone nan tabbed kòm wè nan navigatè entènèt tankou Google Chrome, Internet Explorer nouvo vèsyon ak Firefox Microsoft Word. Li ap Fè yon zouti tan-sove ak irézistibl nan travay ou. Gade anba a Demo:

Klike pou jijman gratis nan Biwo Tab!




Kutools pou Pawòl

Plis pase 100 Fonksyon avanse pou Pawòl 2003, 2007, 2010, 2013, 2016 ak 2019

piki-kutools-700-225-kte

Plis Features | Telechaje gratis | Se sèlman $ 39.00 pou dè santèn de fonksyon

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.
    DaveW · 1 years ago
    Thanks so much for posting this, absolute lifesaver!

    I notice that there is a line "MatchWildcards = False", which implies that it's possible to use wildcards in the search text - is that possible and, if so, what's the protocol?

    Thanks again!
  • To post as a guest, your comment is unpublished.
    Paul Oz · 2 years ago
    Hi all,
    I am new to the whole VBA thing and I Love love love this code!
    I have 5000+ docs to review and if this works it will save heaps of time!
    I have the code above running however i can see that it does not cater for replacing text in footers, Only headers and the body of the doc.
    Can anyone assist in extending this to the entire document.
    P.S. not sure if this is relevant but the list of words that i need to replace is the same for headers, footers and the body...
    Any help would really be appreciated!
    • To post as a guest, your comment is unpublished.
      blue_crayon · 1 years ago
      You can edit the footer by using almost identical code that the header uses. Copy everything from "Begin Header Updates" to "End Header Updates" and paste it directly after.

      Then, in this pasted section, find the word "wdSeekCurrentPageHeader" and change it to "wdSeekCurrentPageFooter".
  • To post as a guest, your comment is unpublished.
    Terence · 2 years ago
    Out of interest what does the line: Application.Run macroname:="NEW MACROS" do?
    The rest of the code makes sense to me (used to VBA in Excel) but I can't figure out why you need to execute another piece of code here.
    Thanks for the great tool though.
  • To post as a guest, your comment is unpublished.
    Mike · 2 years ago
    This macro was amazing..is there any code to update multiple excel files,spss files.also is there is any macro to update the header and footer on multiple word documents .

    Any help is appreciated .thanks !
  • To post as a guest, your comment is unpublished.
    Tracy · 2 years ago
    Just brilliant, saved me lots of time, thank you