Re: Style containing outline numbering - outline number does not appea
by Charles Kenyon » Fri, 16 Sep 2005 03:30:01 GMT
i Chuck,
So far as I know, I came up with the copy three times rule a while back. It
is important when copying linked or cascading styles. Copying once will lose
all links, between styles. Copying three times will retain all links,
between styles. List templates are something else entirely.
I do use the Organizer copy method with outline numbering styles and it
works for me. I just tried it again to make sure, using a template source
that was not created on this computer. The numbering formatting is retained.
The original numbering was set using the procedures outlined in Shauna
Kelly's articles back around 2001. It seems to be stable but I haven't tried
to destruction test it, just used it in practicing law.
The macro for transfering the styles is below.
Sub PleadingStyleTransfer()
'
' PleadingStyleTransfer Macro
' Macro written 14 November 2001 by Charles Kyle Kenyon
'
On Error GoTo NoDocument 'In case called when no document is open.
Dim sThisTemplate As String
Dim sTargetDoc As String
Dim i As Integer
Dim iCount As Integer
Dim rResponse As Variant 'vbMsgBoxResult in Word 2000 or later
sThisTemplate = ThisDocument.FullName
sTargetDoc = ActiveDocument.FullName 'generates error if no document
open
rResponse = MsgBox(Prompt:="This command redefines your Body Text Style
and" _
& vbCrLf & "Heading Styles 1-9. Are you sure you want to do this?" _
& vbCrLf & vbCrLf & "If you are not sure, answer 'No' and make a
backup of your document." _
& vbCrLf & "Then run the command to copy the styles again.", _
Title:="Are you sure you want to redefine your styles?", _
Buttons:=vbYesNo + vbExclamation)
If rResponse = vbNo Then Exit Sub
On Error Resume Next
' Copy Body Text and Pleading Styles to Active Document
For i = 1 To 3 ' copy styles three times
StatusBar = "Copying Styles - Round " & i & " of 3"
With Application
.OrganizerCopy Source:=sThisTemplate, _
Destination:=sTargetDoc, Name:="Body Text,bt,bt1", Object:=
_
wdOrganizerObjectStyles
StatusBar = i & "/3: Body Text"
For iCount = 1 To 9
.OrganizerCopy Source:=sThisTemplate, _
Destination:=sTargetDoc, Name:= _
"Heading " & iCount & ",h" & iCount & ",Pleading " &
iCount _
& ",p" & iCount, Object:= _
wdOrganizerObjectStyles
StatusBar = i & "/3: Pleading " & iCount & " copied"
Next iCount
End With
Next i
StatusBar = "All styles copied."
' Change to Pleading 1 style?
rResponse = MsgBox(Prompt:="Change to Pleading 1 style and go into
Outline view?", _
Buttons:=vbYesNo, Title:="Pleading Styles Imported - start
writing?")
If rResponse = vbYes Then
Selection.Style = ActiveDocument.Styles("Heading 1,h1,Pleading
1,p1")
ActiveWindow.ActivePane.View.Type = wdMasterView
Else 'not now - then reminder
MsgBox Prompt:="The style to start your pleading is Pleading 1 or
p1." _
& vbCrLf & "It is probably easiest to work in Outline view."
End If
Exit Sub
NoDocument:
MsgBox Prompt:="Sorry, this command is only available when you have a
document open." _
& vbCrLf & "It should be used after you have your caption set up.", _
Title:="No