Chinaunix
标题:
如何用vba控制word 表格内容必须不为空
[打印本页]
作者:
renxiao2003
时间:
2011-12-21 08:41
标题:
如何用vba控制word 表格内容必须不为空
Public
WithEvents App As Word
.
Application
Private
Sub
App_DocumentBeforeClose
(
ByVal
Doc As
Document
,
Cancel As Boolean
)
With Doc
.
Tables
(
1
)
For
Each
c
In
.
Range
.
Cells
If
Len
(
c
.
Range
)
<
=
3
Then
a
=
MsgBox
(
"表格填写不完整,确定要退出吗?"
,
vbYesNo
)
If
a
=
vbNo
Then
Cancel
=
True
c
.
Range
.
Select
End
If
Exit
For
End
If
Next
End
With
End
Sub
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2