在我的一个事件中,我正在使用“With ... End With Statement”,所以我需要从“With ... End With Statement”中使用的方法中获取返回值
以我的第一种方式,我可以获取返回值,如
Dim RetVal As MyApp.ErrorConstants
RetVal = AgentApp.Login(txtUserName, txtPassword, txtStation)
之后我将我的代码更改为With ... End With Statement“,以及如何获得返回值
Dim RetVal As MyApp.ErrorConstants
With AgentApp
.Login txtUserName, txtPassword, txtStation
.DisplayMessages = 0
.UISettings.SuppressErrors = False
.UISettings.SuppressMessages = False
End With
答案 0 :(得分:3)
我们可以尝试这样
Dim RetVal As MyApp.ErrorConstants
With AgentApp
RetVal = .Login(txtUserName, txtPassword, txtStation)
.DisplayMessages = 0
.UISettings.SuppressErrors = False
.UISettings.SuppressMessages = False
End With