Subd()
Rem 统计word文档基础信息
Rem 以下均不考虑页眉页脚
i1 = ActiveDocument.Shapes.Count
i2 = ActiveDocument.InlineShapes.Count
i3 = ActiveDocument.Sections.Count
i4 = ActiveDocument.Tables.Count
i5 = ActiveDocument.Bookmarks.Count
i6 = ActiveDocument.Fields.Count
i7 = ActiveDocument.Frames.Count
i8 = ActiveDocument.Footnotes.Count
i10 = ActiveDocument.OMaths.Count
i13 =ActiveDocument.Range.Information(wdNumberOfPagesInDocument) '页数
i14 = ActiveDocument.Endnotes.Count
i15 =ActiveDocument.Range.ComputeStatistics(wdStatisticWords) '字数
For Each oField In ActiveDocument.Fields
If oField.Code.Text Like"*Equation*" Or oField.Code.Text Like "*EQUATION*" Then'Mathtype公式数量
iflag = iflag + 1
End If
Next
If iflag = 0 Then i9 = 0 Else i9 = iflag
For Each oField In ActiveDocument.Fields
If oField.Code.Text Like "*TOC*"Then '目录
lflag = lflag + 1
End If
Next
If lflag = 0 Then i16 = 0 Else i16 = lflag
For i = ActiveDocument.Shapes.Count To 1Step -1
If ActiveDocument.Shapes(i).Type =msoTextBox Then '文本框数量
jflag = jflag + 1
End If
Next
If jflag = 0 Then i11 = 0 Else i11 = jflag
For Each oField In ActiveDocument.Fields
'Debug.Print oField.Type
If oField.Type = wdFieldPageRef OroField.Type = wdFieldTOC Or oField.Code.Text Like "*Toc*" Then '目录域数量
k = k + 1
End If
Next
Rem 统计所有表格的嵌套表格个数(只统计第一层嵌套表格,针对该word文档统计全局嵌套表格总数)
For Each Tbl In ActiveDocument.Tables
kflag = kflag + Tbl.Tables.Count
Next
If kflag = 0 Then i12 = 0 Else i12 = kflag
MsgBox "本文共"& i3 & "节!本文共"& i13 & "页!"& "平均每页"& Round(i15 / i13, 0) & "个字!"& Chr(13) & Chr(13) & "本文共"& i6 - k & "个非目录域(其中"& i9 & "个Mathtype公式,"& i6 - k - i9 & "个其他域)!" _
& Chr(13) & Chr(13) &"本文共"& i16 & "个目录!"& Chr(13) & Chr(13) & "本文共"& i10 & "个自带公式!" _
& Chr(13) & Chr(13) &"本文共"& i4 & "个表格(其中"& i12 & "个嵌套表格)!"& Chr(13) & Chr(13) & "本文共"& i5 & "个书签!" _
& Chr(13) & Chr(13) &"本文共"& i8 & "个脚注!本文共"& i14 & "个尾注!"& Chr(13) & Chr(13) & "本文共"& i2 - i9 & "个InlineShape(不含Mathtype公式)!"& Chr(13) & Chr(13) _
& "本文共"& i1 & "个Shape(其中"& i11 & "个文本框)!"& "本文共"& i7 & "个图文框!"
EndSub