|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub M()
Dim M$
Do
Selection.Find.Text = "^b"
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1 '删除分节符
Selection.MoveUp Unit:=wdScreen, Count:=1, Extend:=wdExtend
Selection.Cut
Documents.Add DocumentType:=wdNewBlankDocument
Selection.PasteAndFormat (wdPasteDefault)
M = ActiveDocument.Paragraphs(1).Range.Text '第一行的文件名,带回车chr(13)
If M = Chr(13) Then Exit Sub
ActiveDocument.SaveAs FileName:=ThisDocument.Path & "\" & Replace(M, Chr(13), "") & ".doc", FileFormat:=wdFormatDocument
ActiveWindow.Close
Loop
End Sub
|
|