[問題] 一頁一頁各別存檔 檔案名稱

看板Office作者 (阿里不打)時間6年前 (2017/08/28 15:04), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/1
(若是和其他不同軟體互動之問題 請記得一併填寫) 軟體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://www.ptt.cc/bbs/Office/M.1503903859.A.C12.html

08/28 20:06, , 1F
如內文標題於該頁第1段落的話 selection.paragraphs(1)來
08/28 20:06, 1F

08/28 20:07, , 2F
取得
08/28 20:07, 2F
文章代碼(AID): #1Pey1pmI (Office)