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
- Vui lòng đọc nội qui diễn đàn để tránh bị xóa bài viết
- Tìm kiếm trước khi đặt câu hỏi
Tách 1 trang trong Word thành 1 file
Điều hành viên: tungblt
-
- Bài viết: 1
- Ngày tham gia: T.Ba 04/03/2014 9:10 pm
Quay về “Visual Basic for Application (VBA)”
Đang trực tuyến
Đang xem chuyên mục này: Không có thành viên nào trực tuyến. và 1 khách