Search code examples
vbasplitms-wordoutline

VBA WORD How to split doc in X docs?


I'd like to split a doc file with some Units in individual units, taking Level 1 Outlined as stop mark. Someone could help me with this? As you can see, I'm a total newbie here. Thanks a lot


Solution

  • Well, I did this. It's not exactly and auto-split process but it does the thing:

    Sub CutSelect()
        Dim ruta As String
        Selection.Cut
    
        ruta = ActiveDocument.Path
        Dim doc As Document
                x = x + 1
                Set doc = Documents.Add
                Selection.Paste
                '-----You can add some other things to do here
                doc.SaveAs ruta & "\" & "Tema " & Format(x, "0")
                '-----So here
                doc.Close True
    
    End Sub
    

    X is set as global var. You can also do some Sub to restart counting as you wish