word打开自动定位上次位置-VBA宏
word VBA实现三个功能:
① 自动定位上次位置;
② 打开后自动缩放指定比例;
③ 缩放后自动居中(可调节)。
Public Sub AutoOpen()
'自动定位上次位置
On Error Resume Next
ActiveDocument.ReturnToLastReadPosition
'打开后自动缩放指定比例
With ActiveDocument.ActiveWindow.View
'Do something with the view and zoom
.Zoom.Percentage = 110
End With
'缩放后自动居中(可调节)
With ActiveWindow
'Ignore any errors
On Error Resume Next
'Reduce flickering while changing settings
.Visible = False
.ActivePane.HorizontalPercentScrolled = 5
'Restore the window now that we're finished
.Visible = True
End With
End Sub
浙公网安备 33010602011771号