|
* 保留副本后,在副本上操作,保留最后一页内容,请楼主试试下面的宏:
Sub test()
'保留最后一页
ActiveDocument.SaveAs FileName:=ActiveDocument.Path & "\" & Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4) & "_副本" & ".doc"
Selection.EndKey Unit:=wdStory
'Sub 选定当前页()
'code by 守柔
Dim CurrentPageStart As Long, CurrentPageEnd As Long
Dim CurrentPage As Integer, Pages As Integer
On Error Resume Next
With Selection
CurrentPage = .Information(wdActiveEndPageNumber)
Pages = .Information(wdNumberOfPagesInDocument)
CurrentPageStart = .GoTo(What:=wdGoToPage, Which:=wdGoToNext, Name:=CurrentPage).Start
If CurrentPage = Pages Then
CurrentPageEnd = ActiveDocument.Content.End
Else
CurrentPageEnd = .GoTo(What:=wdGoToPage, Which:=wdGoToNext, Name:=CurrentPage + 1).Start
End If
ActiveDocument.Range(CurrentPageStart, CurrentPageEnd).Select
End With
Selection.Copy
ActiveDocument.Content.Delete
Selection.Paste
ActiveDocument.Close savechanges:=wdSaveChanges
End Sub |
|