DisplayPageBoundaries 打开word后自动将页面间空白隐藏 (auto+定时器)
每次打开文档都要鼠标点击页面间空白处,将其隐藏
尝试过在
AutoOpen,
AutoExec
等宏中添加
ActiveWindow.View.DisplayPageBoundaries = False
但没有效果
今天发现可以在vba中设置定时器,尝试
AutoOpen
中添加一个定时器,由定时器回调函数实现
ActiveWindow.View.DisplayPageBoundaries = False
Sub HiddenPageBoundaries() On Error Resume Next ActiveWindow.View.DisplayPageBoundaries = False MsgBox ("Hiden Page Bounaries!") End Sub Sub AutoOpen() On Error Resume Next 'Application.DisplayAlerts = wdAlertsNone ActiveWindow.View.ShowSpaces = False Application.OnTime When:=Now + TimeValue("00:00:02"), Name:="HiddenPageBoundaries", Tolerance:=0 End Sub
参考
OnTime