在Word 2010中,使用VBA使第一个文档适合页面

时间:2019-01-25 11:30:26

标签: vba ms-word

Word 2010启动时,我将自动执行VBA代码

ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitFullPage

使文档适合页面。

非常感谢您的提示

2 个答案:

答案 0 :(得分:1)

您可以将命令放在AutoExec宏中。

Sub AutoExec()
    ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitFullPage
End Sub

答案 1 :(得分:0)

您可以将如下所示的宏添加到全局模板的“ ThisDocument”代码模块中(例如Normal.dotm):

Private Sub Document_Open()
With ActiveWindow
  'Reduce flickering while changing settings
  .Visible = False
  'Switch to a single view pane
  .View.SplitSpecial = wdPaneNone
  .View.Type = wdPrintView
  .ActivePane.View.Zoom.PageFit = wdPageFitFullPage
  'Restore the window now that we're finished
  .Visible = True
End With
End Sub