作者Ghivx55123 (阿里不打)
看板Office
标题[问题] 一页一页各别存档 档案名称
时间Mon Aug 28 15:04:16 2017
(若是和其他不同软体互动之问题 请记得一并填写)
软体word
版本:2010
不好意思,请问我想在WORD中一页一页各别存档,使用下列程式码 ,但是名称想从test_
1.....变成内文标题名称,该如何是好?拜托了
Sub BreakOnPage()
' Used to set criteria for moving through the document by page.
Application.Browser.Target = wdBrowsePage
For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")
'Select and copy the text to the clipboard.
ActiveDocument.Bookmarks("\page").Range.Copy
' Open new document to paste the content of the clipboard into.
Documents.Add
Selection.Paste
' Removes the break that is copied at the end of the page, if any.
Selection.TypeBackspace
ChangeFileOpenDirectory "C:\"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
ActiveDocument.Close
' Move the selection to the next page in the document.
Application.Browser.Next
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 101.8.100.202
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Office/M.1503903859.A.C12.html
1F:→ soyoso: 如内文标题於该页第1段落的话 selection.paragraphs(1)来 08/28 20:06
2F:→ soyoso: 取得 08/28 20:07