View Single Post
Old 09-14-04, 06:06 PM   #5 (permalink)
leoram
Aximsite Prospect
 
Join Date: Sep 2004
Posts: 1
Thanked 0 Times in 0 Posts
Modified program

Originally Posted by BonBon
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
Where can I get your version of Word2PML with your routine for titles added? Does it work with foreign language texts, russian in particular? Thank you for your help.
leoram is offline   Reply With Quote