我只是想问:我如何实现“EXCEL”功能,例如:
iferror
iserror
在 VBA“字”中。我知道如何在excel中而不是在word中做到这一点。
例如(excel)
application.worksheetfunction.iferror( ... )
但我正在 MSWord 中编写代码。上面的功能似乎不起作用。
一季度。是否可以?
Q2。如果是的话,你能告诉我代码模式吗?
我尝试搜索谷歌答案,但似乎都指向 excel 方法。非常感谢..
编辑:
为了详细说明我的问题,我在 Word 中有一个用户表单,它应该收集数值并存储在变量中
qty1, qty2 ... qty18, 然后是 uc1, uc2 ... uc18
所以如果我处理变量
If Me.qty1.Value * Me.uc1.Value <> 0 Then
tot1 = Me.qty1.Value * Me.uc1.Value
Else
tot1 = ""
End If
它给了我错误:
类型不匹配
因为当我将 qty2 到 qty18 留空时,它会被理解为空字符串(?),就像在 excel 中一样。
有没有其他方法可以做到这一点?
试试这个
Dim aaa As Double
Dim bbb As Double
Dim tot1 As Double
aaa = Me.qty1.Value
bbb = Me.uc1.Value
tot1 = 0
If IsNumeric(aaa) And IsNumeric(bbb) Then
tot1 = Val(aaa) * Val(bbb)
end if
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句