View Post
在word中如何判断文档是否为空?
If Len(ActiveDocument.Content.Text) <= 1 Then MsgBox "文档是空的!"
如果文档中带有很多空白段落呢?很多全角空格、半角空格、不间断空格、制表符呢?也就是打印是空的呢?
如果是这样,请使用以下代码:
Sub Example()
If ActiveDocument.ComputeStatistics(wdStatisticCharacters, False) = 0 Then MsgBox "文档是空的"
End Sub
若是需要统计脚注和尾注,请将False 改为True.