Pasquale
11-09-2005, 05:36 AM
Exscuse me I repost a thread
Hallo I need still help.
I have a very long text in a doc. I want replace - in first document - all rows that begin with GRK superscipted with the same rows from a second document.
GRK written in superscripted and a sequence of number 1:1, 1:2, 1:3, 2:1, 2:2.... determine the difference from other rows in first document, in the second document all rows begins with GRK superscripted.
GRK rows are in exact sequence in each documents.
Thanks pasquale
example of first document
GRK Mt 1:1 B?bloj gen?sewj 'Ihso? Cristo? u?o? Dau?d u?o? 'Abra?m.
GRT Mt 1:1 Biblos genese?s I?sou Christou huiou Dauid huiou Abraam.
CEI Mt 1:1 Genealogia di Ges? Cristo figlio di Davide, figlio di Abramo.
NVT Mt 1:1 Genealogia di Ges? Cristo, figlio di Davide, figlio di Abramo.
GRK Mt 1:2 'Abra?m ?g?nnhsen t?n 'Isa?k, 'Isa?k d? ?g?nnhsen t?n 'Iak?b, 'Iak?b d? ?g?nnhsen t?n 'Io?dan ka? to?j ?delfo?j a?to?,
GRT Mt 1:2 Abraam egenn?sen ton Isaak, Isaak de egenn?sen ton Iak?b, Iak?b de egenn?sen ton Ioudan kai tous adelphous autou,
CEI Mt 1:2 Abramo gener? Isacco, Isacco gener? Giacobbe, Giacobbe gener? Giuda e i suoi fratelli,
NVT Mt 1:2 Abramo gener? Isacco; Isacco gener? Giacobbe; Giacobbe gener? Giuda e i suoi fratelli;
example of second document
GRK Mt 1:1 B?bloj gen?sewj 'Ihso? Cristo? u?o? Dau?d u?o? 'Abra?m.
GRK Mt 1:2 'Abra?m ?g?nnhsen t?n 'Isa?k, 'Isa?k d? ?g?nnhsen t?n 'Iak?b, 'Iak?b d? ?g?nnhsen t?n 'Io?dan ka? to?j ?delfo?j a?to?,
GRK Mt 1:3 'Io?daj d? ?g?nnhsen t?n F?rej ka? t?n Z?ra ?k t?j Qam?r, F?rej d? ?g?nnhsen t?n `Esr?m, `Esr?m d? ?g?nnhsen t?n 'Ar?m,
GRK Mt 1:4 'Ar?m d? ?g?nnhsen t?n 'Aminad?b, 'Aminad?b d? ?g?nnhsen t?n Naass?n, Naass?n d? ?g?nnhsen t?n Salm?n,
GRK Mt 1:5 Salm?n d? ?g?nnhsen t?n B?ej ?k t?j `Rac?b, B?ej d? ?g?nnhsen t?n 'Iwb?d ?k t?j `Ro?q, 'Iwb?d d? ?g?nnhsen t?n 'Iessa?,
Option Explicit
Sub Greeks()
Dim Doc1 As Document, Doc2 As Document
Dim RegEx As Object
Dim RegO1 As Object, RegO2 As Object, i As Long
Set Doc1 = Documents("FirstDocument")
Set Doc2 = Documents("SecondDocument")
Set RegEx = CreateObject("vbscript.regexp")
RegEx.Global = True
RegEx.Pattern = "(GRK\s{1}Mt\s{1})([0-9]{1,3}:[0-9]{1,3})(.*?\r)"
Set RegO1 = RegEx.Execute(Doc1.Content.Text)
Set RegO2 = RegEx.Execute(Doc2.Content.Text)
'This code would need modding if the ordering system was different between docs
Application.ScreenUpdating = False
For i = 1 To RegO1.Count
If RegO1(i - 1).submatches(1) = RegO2(i - 1).submatches(1) Then
With Doc1.Content.Find
.Text = RegO1(i - 1)
.Replacement.Text = RegO2(i - 1)
.Execute Replace:=wdReplaceOne
End With
End If
Next
Application.ScreenUpdating = True
End Sub
This VBA macro don't work.
Helpme please.:dunno :dunno
Hallo I need still help.
I have a very long text in a doc. I want replace - in first document - all rows that begin with GRK superscipted with the same rows from a second document.
GRK written in superscripted and a sequence of number 1:1, 1:2, 1:3, 2:1, 2:2.... determine the difference from other rows in first document, in the second document all rows begins with GRK superscripted.
GRK rows are in exact sequence in each documents.
Thanks pasquale
example of first document
GRK Mt 1:1 B?bloj gen?sewj 'Ihso? Cristo? u?o? Dau?d u?o? 'Abra?m.
GRT Mt 1:1 Biblos genese?s I?sou Christou huiou Dauid huiou Abraam.
CEI Mt 1:1 Genealogia di Ges? Cristo figlio di Davide, figlio di Abramo.
NVT Mt 1:1 Genealogia di Ges? Cristo, figlio di Davide, figlio di Abramo.
GRK Mt 1:2 'Abra?m ?g?nnhsen t?n 'Isa?k, 'Isa?k d? ?g?nnhsen t?n 'Iak?b, 'Iak?b d? ?g?nnhsen t?n 'Io?dan ka? to?j ?delfo?j a?to?,
GRT Mt 1:2 Abraam egenn?sen ton Isaak, Isaak de egenn?sen ton Iak?b, Iak?b de egenn?sen ton Ioudan kai tous adelphous autou,
CEI Mt 1:2 Abramo gener? Isacco, Isacco gener? Giacobbe, Giacobbe gener? Giuda e i suoi fratelli,
NVT Mt 1:2 Abramo gener? Isacco; Isacco gener? Giacobbe; Giacobbe gener? Giuda e i suoi fratelli;
example of second document
GRK Mt 1:1 B?bloj gen?sewj 'Ihso? Cristo? u?o? Dau?d u?o? 'Abra?m.
GRK Mt 1:2 'Abra?m ?g?nnhsen t?n 'Isa?k, 'Isa?k d? ?g?nnhsen t?n 'Iak?b, 'Iak?b d? ?g?nnhsen t?n 'Io?dan ka? to?j ?delfo?j a?to?,
GRK Mt 1:3 'Io?daj d? ?g?nnhsen t?n F?rej ka? t?n Z?ra ?k t?j Qam?r, F?rej d? ?g?nnhsen t?n `Esr?m, `Esr?m d? ?g?nnhsen t?n 'Ar?m,
GRK Mt 1:4 'Ar?m d? ?g?nnhsen t?n 'Aminad?b, 'Aminad?b d? ?g?nnhsen t?n Naass?n, Naass?n d? ?g?nnhsen t?n Salm?n,
GRK Mt 1:5 Salm?n d? ?g?nnhsen t?n B?ej ?k t?j `Rac?b, B?ej d? ?g?nnhsen t?n 'Iwb?d ?k t?j `Ro?q, 'Iwb?d d? ?g?nnhsen t?n 'Iessa?,
Option Explicit
Sub Greeks()
Dim Doc1 As Document, Doc2 As Document
Dim RegEx As Object
Dim RegO1 As Object, RegO2 As Object, i As Long
Set Doc1 = Documents("FirstDocument")
Set Doc2 = Documents("SecondDocument")
Set RegEx = CreateObject("vbscript.regexp")
RegEx.Global = True
RegEx.Pattern = "(GRK\s{1}Mt\s{1})([0-9]{1,3}:[0-9]{1,3})(.*?\r)"
Set RegO1 = RegEx.Execute(Doc1.Content.Text)
Set RegO2 = RegEx.Execute(Doc2.Content.Text)
'This code would need modding if the ordering system was different between docs
Application.ScreenUpdating = False
For i = 1 To RegO1.Count
If RegO1(i - 1).submatches(1) = RegO2(i - 1).submatches(1) Then
With Doc1.Content.Find
.Text = RegO1(i - 1)
.Replacement.Text = RegO2(i - 1)
.Execute Replace:=wdReplaceOne
End With
End If
Next
Application.ScreenUpdating = True
End Sub
This VBA macro don't work.
Helpme please.:dunno :dunno