View Single Post
Old 12-24-03, 03:19 PM   #2 (permalink)
BonBon
Aximsite Prospect
 
Join Date: Dec 2003
Posts: 4
Thanked 0 Times in 0 Posts
Big Smile

Thanks Talyn, I've been looking for this everywhere.

In case you're interested, I added a subroutine to handle Chapter Titles.
Just apply style 'Heading 1', 'Heading 2', 'Heading 3' for corresponding chapter title level 1, 2, and 3. Then this macro will put chapter title enclosure on them.
The good thing about having chapter titles is we'll also have a nice table of contents.

Code:
Private Sub doHeading()
    Dim i As Integer
    '''Heading 1 -> /X0 ... /X0
    '''Heading 2 -> /X1 ... /X1
    '''Heading 3 -> /X2 ... /X2
    For i = 0 To 2
        Selection.HomeKey unit:=wdStory
        With Selection.Find
            .Format = True
            .ClearFormatting
            .Style = "Heading " & Trim(Str(i + 1))
            .Text = ""
            .Wrap = wdFindContinue
            Do While .Execute
                Selection.Text = "\X" & Trim(Str(i)) & Selection.Text & "\X" & Trim(Str(i))
                Selection.MoveRight unit:=wdCharacter, Count:=1
            Loop
        End With
    Next i
End Sub
Then, just call this routine from the main sub Public Sub Word2PML() before the end of the sub.

Code:
    Application.Run macroname:="doHeading"
cheers,

BonBon
BonBon is offline   Reply With Quote