运行子例程RunMe可以在2019年8月Windows更新之前运行。
2019年8月Windows更新后,运行子例程RunMe失败。它报告以下错误信息:“无效的过程调用或参数(错误5)”
Public Sub RunMe()
Dim wksTestArray() As Worksheet
MsgBox SendArrayToFunction(wksTestArray())
End Sub
Public Function SendArrayToFunction(ByVal vntArray As Variant) As Boolean
SendArrayToFunction = True
End Function
Run Code Online (Sandbox Code Playgroud)
请注意:错误仅在未分配的阵列中发生。
对于函数来说,接受Variant可能很有用,该Variant可以是值的数组或对象的数组,例如,IsArrayAllocated是需要此功能的示例函数。
有解决办法吗?
此更新影响VB6,VBA(包括Office的所有版本)以及VBScript!
Microsoft当前正在调查该问题:https : //support.microsoft.com/en-us/help/4512488/windows-8-1-update-kb4512488(请查看标题为“本问题中的已知问题”部分下的最后一行更新”)
更新:
Microsoft刚刚发布了针对此问题的补丁程序:https : //support.microsoft.com/zh-cn/help/4517298/windows-8-1-update-kb4517298
要修复此问题,请将函数中的 ByVal 更改为 ByRef:
Public Sub RunMe()
Dim wksTestArray() As Worksheet
MsgBox SendArrayToFunction(wksTestArray())
End Sub
Public Function SendArrayToFunction(ByRef vntArray As Variant) As Boolean
SendArrayToFunction = True
End Function
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
613 次 |
| 最近记录: |