WORD运行VBA,提示4608错误,数据超出范围

 

WORD中运行如下代码,有的WORD能成功,有的WORD提示如下,头都大了到底咋回事,求助。

 

Sub 页面批量格式()
'
' 页面批量格式 宏
'
'
    Selection.WholeStory
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup '进行页面设置
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(2.54) '上边距
        .BottomMargin = CentimetersToPoints(2.54) '下边距
        .LeftMargin = CentimetersToPoints(2.59) '左边距
        .RightMargin = CentimetersToPoints(2.4) '右边距
        .Gutter = CentimetersToPoints(0) '装订线
        .HeaderDistance = CentimetersToPoints(1.1) '页眉
        .FooterDistance = CentimetersToPoints(0.53) '页脚
        .PageWidth = CentimetersToPoints(21) '纸张宽
        .PageHeight = CentimetersToPoints(29.7) '纸张高
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage '节的起始位置:新建页
        .OddAndEvenPagesHeaderFooter = False '不勾选“奇偶页不同”
        .DifferentFirstPageHeaderFooter = False '不勾选“首页不同”
        .VerticalAlignment = wdAlignVerticalTop '页面垂直对齐方式为“顶端对齐”
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1 '默认打印份数为1
        .GutterPos = wdGutterPosLeft '装订线位于左侧
        .LayoutMode = wdLayoutModeDefault
    End With
        MsgBox "页面批量格式已完成"

应该可以定位到错误行吧,在word里面打开宏,选择编辑纸里的可以打开VB调试界面