Word | Save Selected Text To New Documents

PHOTO EMBED

Fri Apr 08 2022 02:06:07 GMT+0000 (Coordinated Universal Time)

Saved by @cnewnham #vba

Sub SaveSelectedTextToNewDocument()
    If Selection.Words.Count > 0 Then
    'Copy the selected text
    Selection.Copy            

    'Open a new document and paste the copied text into it
    Dim objNewDoc As Document
    Set objNewDoc = Documents.Add
    Selection.Paste

    'Get the first 10 characters as the filename of the new document and save them
    Dim objFileName As Range
    Set objFileName = objNewDoc.Range(Start:=0, End:=10)
    objNewDoc.SaveAs FileName:="C:\Users\Test\Desktop\" & objFileName & ".docx"
    Else

    End If
End Sub
content_copyCOPY

Among the codes, the “C:\Users\Test\Desktop\” refers to the path where the new documents will be stored. You can change it as you like. The codes “Set objFileName = objNewDoc.Range(Start:=0, End:=10)” means we will have the first 10 characters of the selected text as the name of new file. Likely, you can also change this part accordingly.

https://www.datanumen.com/blogs/2-quick-ways-split-word-document-multiple-ones/