/ Forums / Advansys Formativ / Creating Solutions with Formativ / Checking Message Type / Reply To: Checking Message Type
April 13, 2009 at 5:13 pm
#8110
“Client.ClientState.CommandMessage” expect, you have selected some messages and will throw error if no messages selected.
The code enabled error handling by calling “On Error Resume Next” which causes execution to continue with the statement immediately following the statement that caused the run-time error. See the Microsoft® Visual Basic® Scripting Guide for more information.
You can ignore the error or clear it by calling “err.clear”. If your code only require the first selected message then you can use the optimise code below.
dim oMsg
Sub Main(Client, GWEvent)
if IsMessageSelected(Client) then
msgbox oMsg.subject
end if
set oMsg = nothing
End Sub
' Is any message selected in the GroupWise client?
' Return type: True/False
Public Function IsMessageSelected(Client)
On Error Resume Next
set oMsg = nothing
Set oMsg = Client.ClientState.CommandMessage
IsMessageSelected = not (oMsg is nothing)
err.clear
End Function
Hope this helps.
Regards,
Advansys Support