inverting order of paragraphs

E

Elmsley

I have a document in which I would like the firs paragraph to be the last, the second to be the second last, etc. Does anyone know how to do this?
 
R

Rob Schneider

Elmsley said:
I have a document in which I would like the firs paragraph to be the last, the second to be the second last, etc. Does anyone know how to do this?

Should be possible to get some to write a macro to do this if this is
largish document where the time/cost to develop something makes it a
better proposition than doing it manually in Word. Do you have a budget
in mind?
 
B

Bruce

You might be able to use the spike (work with a copy of
the document, of course). Look up Spike in Word help.
Don't know what the limit is to the amount of information
you can move this way, but you could do it in batches if
need be.
-----Original Message-----
I have a document in which I would like the firs
paragraph to be the last, the second to be the second
last, etc. Does anyone know how to do this?
 
S

Suzanne S. Barnhill

One way would be to apply ABC autonumbering to the paragraphs (assuming
there are no more than 26); omit the period and tab so you have just a
single letter at the beginning of each paragraph. Then you would need to
convert the "numbers" to plain text. There's a VBA way to do that, which I
don't have at my fingertips, but I believe saving as RTF will accomplish the
same thing. Reopen and sort in reverse order, then remove the letters. This
is pretty labor-intensive, though.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Elmsley said:
I have a document in which I would like the firs paragraph to be the last,
the second to be the second last, etc. Does anyone know how to do this?
 
J

Jay Freedman

I'd be reluctant to charge anyone money for something this simple:

Sub ReverseParas()
Dim docSrc As Document
Dim docDest As Document
Dim rgDest As Range
Dim pSrc As Paragraph

On Error GoTo bye

Set docSrc = ActiveDocument
Set docDest = Documents.Add
Set rgDest = docDest.Range

For Each pSrc In docSrc.Paragraphs
rgDest.Collapse wdCollapseStart
rgDest.FormattedText = pSrc.Range.FormattedText
Next pSrc

docDest.Save

bye:
End Sub
 
R

Rob Schneider

Jay said:
I'd be reluctant to charge anyone money for something this simple:

Sub ReverseParas()
Dim docSrc As Document
Dim docDest As Document
Dim rgDest As Range
Dim pSrc As Paragraph

On Error GoTo bye

Set docSrc = ActiveDocument
Set docDest = Documents.Add
Set rgDest = docDest.Range

For Each pSrc In docSrc.Paragraphs
rgDest.Collapse wdCollapseStart
rgDest.FormattedText = pSrc.Range.FormattedText
Next pSrc

docDest.Save

bye:
End Sub

That's why you are an MVP! Well done. Very elegant. I was thinking of
something a bit more brute force.

(I started thinking about it an figured it would be a 1 hr job to get it
right ... which means it really would be 3 hrs and at that point ...).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top