PDA

View Full Version : Move txt



Pasquale
08-27-2006, 01:58 AM
Hallo,
I need help for move txt in the same document.
I attach an example.
Thanks
Pasquale

fumei
08-28-2006, 02:26 PM
Uh, could you be more specific? You have a lot of modules there in the file. I am trying to find your "example".

Pasquale
08-28-2006, 08:49 PM
Hallo Fumei, thanks.

Original txt:
1. The title of the Psalm is, "For her who receiveth the inheritance." The Church then is signified, who receiveth for her inheritance eternal life through our Lord Jesus Christ; that she may possess God Himself, in cleaving to whom she may be blessed, according to that, "Blessed are the meek, for they shall possess the earth." [115] What earth, but that of which it is said, "Thou art my hope, my portion in the land of the living"? [116] And again more clearly, "The Lord is the portion of mine inheritance and of my cup." [117] And conversely the word Church is said to be God's inheritance according to that, "Ask of Me, and I shall give thee the heathen for thine inheritance." [118] Therefore is God said to be our inheritance, because He feedeth and sustaineth [119] us: and we are said to be God's inheritance, because He ordereth and ruleth us. Wherefore it is the voice of the Church in this Psalm called to her inheritance, that she too may herself become the inheritance of the Lord.

2. "Hear my words, O Lord" (Psa 5:1). Being called she calleth upon the Lord; that the same Lord being her helper, she may pass through the wickedness of this world, and attain unto Him. "Understand my cry." The Psalmist well shows what this cry is; how from within, from the chamber of the heart, without the body's utterance, [120] it reaches unto God: for the bodily voice is heard, but the spiritual is understood. Although this too may be God's hearing, not with carnal ear, but in the omnipresence of His Majesty.
_________________________________________________________________
[115] Matt. 5:5.
[116] Ps. 142:5.
[117] Ps. 16:5.
[118] Ps. 2:8.
[119] Continet.
[120] Strepitu.

FINAL TXT:

1. The title of the Psalm is, "For her who receiveth the inheritance." The Church then is signified, who receiveth for her inheritance eternal life through our Lord Jesus Christ; that she may possess God Himself, in cleaving to whom she may be blessed, according to that, "Blessed are the meek, for they shall possess the earth." [115] What earth, but that of which it is said, "Thou art my hope, my portion in the land of the living"? [116] And again more clearly, "The Lord is the portion of mine inheritance and of my cup." [117] And conversely the word Church is said to be God's inheritance according to that, "Ask of Me, and I shall give thee the heathen for thine inheritance." [118] Therefore is God said to be our inheritance, because He feedeth and sustaineth [119] us: and we are said to be God's inheritance, because He ordereth and ruleth us. Wherefore it is the voice of the Church in this Psalm called to her inheritance, that she too may herself become the inheritance of the Lord.
_________________________________________________________________
[115] Matt. 5:5.
[116] Ps. 142:5.
[117] Ps. 16:5.
[118] Ps. 2:8.
[119] Continet.
_________________________________________________________________

2. "Hear my words, O Lord" (Psa 5:1). Being called she calleth upon the Lord; that the same Lord being her helper, she may pass through the wickedness of this world, and attain unto Him. "Understand my cry." The Psalmist well shows what this cry is; how from within, from the chamber of the heart, without the body's utterance, [120] it reaches unto God: for the bodily voice is heard, but the spiritual is understood. Although this too may be God's hearing, not with carnal ear, but in the omnipresence of His Majesty.
_________________________________________________________________
[120] Strepitu.

colored txt is only for example

pasquale

mdmackillop
08-29-2006, 12:04 AM
You certainly come up with some interesting and different challenges!

A couple of questions.
In your sample, every paragraph is individually numbered. Is this consistent throughout your text?
Can you confirm that there is no repitition of numbering within the same Word document.

Pasquale
08-29-2006, 12:10 AM
Hallo mdmackillop,
Thanks for replay.

Yes I confirm that every paragraph is individually numbered and that there is no repitition of numbering within the same Word document.

pasquale

fumei
08-29-2006, 12:11 PM
I am not following this.

You say the paragraphs are numbered. But what does that mean??? Can they be identified by that number?

What does [120] in the middle of the paragraph mean?

How are you identifying WHERE to move the paragraph? Are you using the Selection object - in other words, if the Selection is in a specific paragraph is it THAT paragraph you are wanting to move? Or are you trying to move a specific paragraph no matter where the Selection is?

If things are bookmarked, then it would make thing much easier.

fumei
08-29-2006, 12:12 PM
Also, could you say which of the procedures, in which code module, you are trying to work with?

fumei
08-29-2006, 12:18 PM
By the way, your procedures for drawing spirals and roses is very cute.

Pasquale
08-29-2006, 01:27 PM
Thanks Fumei:think:

mdmackillop
08-31-2006, 12:35 AM
Hi Pasquale
Still working on this.

Progress to date shown below. This creates an array of paragraph numbers (actual, not yours), indexes and footnotes. The remaining task is to write the array values after the corresponding paragraphs.
Because the wildcard search looks between [] for numbers, the use of these brackets elsewhere upsets this. (Unless I can find a number only search) RegExp anyone?

mdmackillop
09-01-2006, 11:59 AM
Not quite there, but getting close.


Option Explicit
Dim arr()
Dim Location As Long
Dim Ends As Long, k As Long
Sub Macro1()
'Find where indexes start to repeat at end of document
'Insert a bookmark at this location
Dim First As String
selection.HomeKey Unit:=wdStory
With selection.Find
.Text = "\[*\]"
.MatchWildcards = True
.Execute
End With
First = selection
selection.MoveRight Unit:=wdCharacter, Count:=1
With selection.Find
.Text = First
.MatchWildcards = False
.Execute
End With
selection.HomeKey Unit:=wdLine
selection.TypeParagraph
selection.TypeParagraph
selection.MoveUp Unit:=wdLine, Count:=2
Location = selection.End
Ends = Paras(selection)
With ActiveDocument.Bookmarks
.Add Range:=selection.Range, Name:="xxx"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
selection.HomeKey Unit:=wdStory
Macro2
Macro3
Macro4
End Sub
Sub Macro2()
'Check for indexes and record paragraph number
'and index in array. Exit at bookmark location
Dim First As String, Last As String
Dim rg As Range
Dim i As Long

ReDim arr(2, 500)
selection.HomeKey Unit:=wdStory
First = ""
Do
With selection.Find
.Text = "\[*\]"
.MatchWildcards = True
.Forward = True
.Wrap = False
.Execute
If First = "" Then First = selection
Last = selection
If selection.End > Location Then Exit Do
i = i + 1
arr(0, i) = Paras(selection)
arr(1, i) = selection
End With
Loop
k = i
ReDim Preserve arr(2, i)
End Sub
Sub Macro3()
'Read footnotes into array
Dim R As Range
Dim i As Long, j As Long
On Error GoTo Exits
selection.GoTo What:=wdGoToBookmark, Name:="xxx"
Do
With selection.Find
.Text = "\[*\]"
.MatchWildcards = True
.Forward = True
.Wrap = False
.Execute
'If selection.End > Location Then Exit Do
i = i + 1
'Debug.Print selection
Set R = ActiveDocument.Paragraphs(Paras(selection)).Range
arr(2, i) = R.Text
End With
Loop
Exits:
For j = 1 To i - 1
Debug.Print arr(0, j) & " - " & arr(1, j) & " - " & arr(2, j)
Next
End Sub
Sub Macro4()
Dim i As Long, j As Long
Dim Strt As Boolean
j = 1
For i = Ends To 1 Step -1
ActiveDocument.Paragraphs(i + 1).Range.Select
selection.Collapse Direction:=wdCollapseEnd
j = 1
For j = 1 To k - 1
If arr(0, j) = i Then
If Strt = True Then
selection.TypeParagraph
Strt = False
End If
selection.TypeText arr(2, j)
End If
Next
selection.TypeText "_______________________________________________________"
selection.TypeParagraph
Next
End Sub
Function Paras(selection)
'Return selection paragraph number
Dim MyRange1 As Range
Set MyRange1 = ActiveDocument.Range(Start:=0, End:=0)
MyRange1.SetRange Start:=MyRange1.Start, _
End:=selection.Range.End
Paras = MyRange1.Paragraphs.Count
End Function

Pasquale
09-01-2006, 10:52 PM
Hallo mdmackillop,
Thanks for your interest. At the moment it does not work.
pasquale

mdmackillop
09-02-2006, 01:56 AM
Any suggestions?

Pasquale
09-02-2006, 02:23 AM
Yes,
I am working manually with my long long txt.

Thanks very much.

I solved the trhead!