楼主说的功能,应该用到VBA而不是VB 可以试一试我用VBA写的代码
[Visual Basic] 纯文本查看 复制代码 Dim xInlines As Long
Dim xFloaters As Long
Dim sh As Shape
Dim tbxs As Long
Dim msg As String
With ActiveDocument
For Each sh In .Shapes
If sh.Type = msoTextBox Then tbxs = tbxs + 1
Next
xInlines = .InlineShapes.Count
Floaters = .Shapes.Count - tbxs
End With
xPrompt = "内嵌图片:" & vbTab & xInlines & vbCr
xPrompt = xPrompt & "浮动形状有:" & vbTab & xFloaters & vbCr
xPrompt = xPrompt & vbTab & "总共:" & vbTab & (xInlines + xFloaters) & vbCr
xPrompt = xPrompt & "计数不包括页眉和页脚等。"
MsgBox xPrompt, vbInformation, "我的统计"
可以把xPrompt的数值赋给TextBox1控件的Text属性
|