Trang 1 trên 1

Tách 1 trang trong Word thành 1 file

Đã gửi: T.Ba 30/01/2018 4:01 pm
gửi bởi vantoanht01
Các cao thủ giúp cách xử lý em với
Cần tách Auto 1 trang trong Word thành 1 file riêng biệt

Sub SlpipFile()
Dim i As Long
Application.ScreenUpdating = False
ChangeFileOpenDirectory ActiveDocument.Path
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^k"
.Forward = True
.Wrap = wdFindContinue
End With
ActiveDocument.Range(0, 0).Select
Do Until Selection.Find.Execute = False
i = i + 1
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdParagraph, Count:=999999999, Extend:=wdExtend
Selection.Cut
Selection.TypeBackspace
ActiveDocument.SaveAs "File_" & VBA.Format(i, "000") & ".doc", 0
ActiveDocument.Close
Documents.Add DocumentType:=wdNewBlankDocument
Selection.Paste
ActiveDocument.Range(0, 0).Select
Loop
ActiveDocument.SaveAs "File_" & VBA.Format(i + 1, "000") & ".doc", 0
Application.ScreenUpdating = True
End Sub