A
Associates
Hi,
I need help with the following code.
Public Sub ReapplyRestarts()
' Sample macro to reapply restarts lost by a copy and paste
Dim aBookmark As Bookmark
Dim RestartPoint As Range
For Each aBookmark In ActiveDocument.Bookmarks
If aBookmark.Name Like "restart*" Then ' it's a restart point
Set RestartPoint = aBookmark.Range
RestartPoint.Collapse wdCollapseEnd
RestartPoint.MoveEnd unit:=wdCharacter, Count:=-1
With RestartPoint.ListFormat
..ApplyListTemplate .ListTemplate, ContinuePreviousList:=False
End With
aBookmark.Delete
End If
Next aBookmark
End Sub
I found the code above from
http://word.mvps.org/faqs/numbering/ListRestartFromVBA.htm.
However, this code has some error (e.g. Argument not optional) in the
following line
..ApplyListTemplate .ListTemplate, ContinuePreviousList:=False
already fixed after being replaced by
..ApplyListTemplate ListTemplate, ContinuePreviousList:=False
But then, i was having troubled with defining for the variable
"ListTemplate". I wonder if anyone might be able to help get around it.
Any help would be greatly appreciated.
Thank you in advance
I need help with the following code.
Public Sub ReapplyRestarts()
' Sample macro to reapply restarts lost by a copy and paste
Dim aBookmark As Bookmark
Dim RestartPoint As Range
For Each aBookmark In ActiveDocument.Bookmarks
If aBookmark.Name Like "restart*" Then ' it's a restart point
Set RestartPoint = aBookmark.Range
RestartPoint.Collapse wdCollapseEnd
RestartPoint.MoveEnd unit:=wdCharacter, Count:=-1
With RestartPoint.ListFormat
..ApplyListTemplate .ListTemplate, ContinuePreviousList:=False
End With
aBookmark.Delete
End If
Next aBookmark
End Sub
I found the code above from
http://word.mvps.org/faqs/numbering/ListRestartFromVBA.htm.
However, this code has some error (e.g. Argument not optional) in the
following line
..ApplyListTemplate .ListTemplate, ContinuePreviousList:=False
already fixed after being replaced by
..ApplyListTemplate ListTemplate, ContinuePreviousList:=False
But then, i was having troubled with defining for the variable
"ListTemplate". I wonder if anyone might be able to help get around it.
Any help would be greatly appreciated.
Thank you in advance