Macro - Select List to Copy + Paste

K

Karen

Hi All,

I'm trying to write a macro that selects one simple list
(located in a particular section of the word document)-
copy the list and paste it elsewhere.

Is it possible to bookmark the beginning of that one list,
then use code to select all items in the list at once and
then use the keyboard to copy and paste it into the
appropriate area via another bookmark?

Can someone please let me know what code I need or how I
cna achieve this in a simple way without writing code?

Thanks,
Karen
 
H

Helmut Weber

Hi Karen,
I fear, there is no simple way. At last,
I think I got a macro that selects the next
list in a document. It looks like that:
-----------------------------------------
Sub SelectNextList()
Dim arrPrg() As Integer ' array of paragraphs
Dim actPrg As Integer ' actual paragraph
Dim allPrg As Integer ' count all paragraphs
Dim tmpRng As Range ' temporary range
Dim i, j As Integer
Set tmpRng = Selection.Range
allPrg = ActiveDocument.Paragraphs.Count
ReDim arrPrg(allPrg)
With Selection.Range.ListParagraphs
If .Count > 0 Then
MsgBox "Selection is already in a list"
Exit Sub
End If
End With

With ActiveDocument
For i = 1 To allPrg
If .Paragraphs(i).Range.ListParagraphs.Count Then
arrPrg(i) = 1
Else
arrPrg(i) = 0
End If
Next
End With
tmpRng.Start = 0
tmpRng.End = Selection.Range.End
actPrg = tmpRng.Paragraphs.Count ' the actual paragraph
For i = actPrg + 1 To allPrg
If arrPrg(i) = 1 Then
tmpRng.Start = _
ActiveDocument.Paragraphs(i).Range.Start
Exit For
End If
Next
For j = i + 1 To allPrg
If arrPrg(j) = 1 Then
tmpRng.End = _
ActiveDocument.Paragraphs(j).Range.End
Else
Exit For
End If
Next
tmpRng.Select
End Sub
------------------------------------------
Copying and pasting should not be a problem.
You might have to take care of automatic continuation
of listnumbering.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0

may be taken care of.
 

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