Skip to main content

Conas comhaid iolracha a chuardach agus a athsholáthar i bhfocal?

Má tá cúpla dosaen comhad focal agat ina bhfuil an t-ábhar céanna (mar shampla Ceanntásc, buntásc, roinnt focal nó uimhir speisialta), agus ní mór duit an t-ábhar céanna a athsholáthar ar fud na ndoiciméad sin i Word. Conas a bheadh ​​sé níos éasca duit é a chur i gcrích go tapa? Cinnte, is féidir leat na comhaid sin a oscailt ceann ar cheann chun an t-ábhar céanna a athsholáthar, ach tógfaidh sé am agus trioblóideach. Taispeánfaidh an rang teagaisc seo bealach fánach duit an t-ábhar céanna a athsholáthar laistigh de dhoiciméid iolracha i Word ag an am céanna.

Faigh agus cuir téacs VBA in ionad téacsanna ar fud cáipéisí iolracha ag an am céanna
Téacsanna éagsúla a aimsiú agus a athsholáthar go héasca thar iliomad doiciméad ag an am céanna le Kutools for Word


Faigh agus cuir téacs VBA in ionad téacsanna ar fud cáipéisí iolracha ag an am céanna

1. Brúigh Eile + F11 a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

2. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil IonsáighModúil, ansin cóipeáil an cód VBA seo a leanas isteach i bhfuinneog an Mhodúil.

Cód VBA: An t-ábhar céanna a chuardach agus a athsholáthar ar fud iliomad doiciméad ag aon am amháin

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. Brúigh an F5 eochair chun an cód a rith.

4. San oscailt Brabhsáil fuinneog, faigh agus roghnaigh na cáipéisí a gheobhaidh tú agus cuir téacs nua ina n-áit, agus ansin cliceáil ar an OK cnaipe. Féach an pictiúr:

5. Sa chéad cheann Kutools le haghaidh Word bosca dialóige, cuir isteach an téacs a gheobhaidh tú ar fud na ndoiciméad isteach sa Aimsigh cad bosca, agus ansin cliceáil ar an OK cnaipe.

6. Sa dara ceann Kutools le haghaidh Word bosca dialóige, cuir isteach an téacs a chuirfidh tú ina ionad, agus cliceáil ar an OK cnaipe.

8. Cliceáil ar an OK cnaipe sa chéad cheann eile Microsoft Word bosca dialóige chun an toradh a chríochnú agus a athsholáthar.

Sa chás seo, cuirtear “Excel” in ionad gach focal “Word” i ndoiciméid roghnaithe ag an am céanna.


Téacsanna éagsúla a aimsiú agus a athsholáthar go héasca thar iliomad doiciméad ag an am céanna le Kutools for Word

Seo a mholadh go mór an Faigh Baisc agus Ionadaigh gné de Kutools le haghaidh Word. Leis an ngné seo, is féidir leat téacsanna éagsúla a aimsiú agus a athsholáthar go héasca ar fud iliomad doiciméad Word ag an am céanna. Feicfimid conas an ghné seo a chur i bhfeidhm chun téacsanna a aimsiú agus a athsholáthar ar fud cáipéisí.

Kutools le haghaidh Word : le níos mó ná 100 breiseán áisiúil Word, saor chun iarracht a dhéanamh gan aon teorainn i 60.

1. Cliceáil le do thoil Kutools Plus > Faigh Baisc agus Ionadaigh chun an ghné a chumasú.

2. Sa Faigh Baisc agus Ionadaigh bosca dialóige, cumraigh mar a leanas le do thoil.

  • 2.1) Cliceáil ar an Cuir Rae leis cnaipe faoi Aimsigh agus Ionadaigh cluaisín;
  • 2.2) Sna réimsí as a chéile a cruthaíodh:
A. Cuir isteach an téacs a gheobhaidh tú sa bhosca téacs sa Aimsigh gcolún
B. Cuir isteach an téacs a chuirfidh tú in áit sa bhosca téacs sa Ionadaigh colún;
C. Sonraigh cineál cuardaigh, cá bhfaighidh tú an téacs agus dath chun aird a tharraingt ar an téacs de réir mar a theastaíonn uait. Sa chás seo, roghnaím Meaitseáil iomlán focal, Príomhdhoiciméad agus dath áirithe ón Cineál Cuardaigh, Faigh isteach agus Aibhsigh colúin;
  • 2.3) Déan céim 2.1 agus 2.2 arís chun tuilleadh téacsanna a gheobhaidh tú a chur leis agus a athsholáthar;
  • 2.4) Cliceáil ar an  cnaipe sa Cineál Comhad alt chun na doiciméid Word a chur leis ina bhfaighidh tú téacsanna agus ina n-ionad iad;
  • 2.5) Cliceáil ar an Ionadaigh or Aimsigh cnaipe. Féach an pictiúr:

nótaí:
1. Má chliceálann tú ar an Aimsigh cnaipe, taispeánfar na torthaí aimsithe go léir faoin Toradh Réamhamhairc cluaisín. Tar éis réamhamharc a dhéanamh ar na torthaí, más mian leat gach téacs a athsholáthar, cliceáil ar an Aimsigh agus Ionadaigh cluaisín. Seachas sin, dún an dialóg.

2. Má chliceálann tú ar an Ionadaigh cnaipe, cuirfear téacsanna nua in ionad gach téacs sonraithe láithreach, agus taispeánfar na torthaí faoin Toradh Réamhamhairc Tab.

3. Má shonraíonn tú dathanna aibhsithe i gcéim 2, cuirfear dathanna sonraithe in iúl do gach téacs nua, agus is féidir sracfhéachaint a fháil orthu i ndoiciméid.

3. Dún an Faigh Baisc agus Ionadaigh bosca dialóige

Le haghaidh tuilleadh faisnéise faoin ngné seo, le do thoil Cliceáil anseo....

Más mian leat triail saor in aisce a bhaint as an bhfóntas seo, téigh chuig íoslódáil saor in aisce na bogearraí ar dtús, agus ansin téigh chun an oibríocht a chur i bhfeidhm de réir na gcéimeanna thuas.

Uirlisí Táirgiúlachta Oifige is Fearr

Kutools le haghaidh Word - Elevate Your Word Experience with Over 100 Gnéithe Suntasacha!

🤖 Cúntóir Kutools AI: athraigh do chuid scríbhinn le AI - Gin Ábhar  /  Athscríobh Téacs  /  Déan achoimre ar Dhoiciméid  /  Fiosraigh le haghaidh Faisnéise bunaithe ar Doiciméad, ar fad laistigh de Word

📘 Máistreacht Doiciméad: Leathanaigh Scoilte  /  Cumaisc Doiciméid  /  Roghnú Easpórtála i bhFormáidí Éagsúla (PDF/TXT/DOC/HTML...)  /  Baisc a thiontú go PDF  /  Easpórtáil Leathanaigh mar Íomhánna  /  Priontáil Comhaid Il ag an am céanna...

Eagarthóireacht na nÁbhar: Faigh Baisc agus Ionadaigh thar Chomhaid Il  /  Athraigh Méid Gach Pictiúr  /  Trasnaigh Rónna Tábla agus Colúin  /  Tiontaigh Tábla go Téacs...

🧹 Effortless Glan: Sguab as Spásanna Breise  /  Sosanna Alt  /  Gach Ceanntásca  /  Boscaí Téacs  /  Hipearnasc  / Le haghaidh tuilleadh uirlisí a bhaint, ceann chuig ár Bain Grúpa...

Ionsáigh Cruthaitheach: cuir isteach Míle Deighilteoir  /  Boscaí Seiceála  /  Cnaipí Raidió  /  Cód QR  /  barcode  /  Tábla Líne Trasnánach  /  Fotheideal Cothromóid  /  Fotheideal Íomhá  /  Fotheideal Tábla  /  Pictiúir Il  / Faigh amach níos mó sa Cuir isteach Grúpa...

🔍 Roghanna Beachtais: Pionta leathanaigh ar leith  /  táblaí  /  cruthanna  /  míreanna ceannteideal  / Feabhsaigh an loingseoireacht le níos mó Roghnaigh gnéithe...

Feabhsuithe Réalta: Déan nascleanúint go tapa chuig aon láthair  /  cuir isteach téacs athchleachtach go huathoibríoch  /  scoránaigh gan uaim idir fuinneoga doiciméad  /  11 Uirlisí Tiontaithe...

???? Ar mhaith leat triail a bhaint as na gnéithe seo? Kutools le haghaidh Word cuireann a Triail saor in aisce 60 lá, gan teorainneacha! 🚀
 
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