• Creator
    Topic
  • #4407
    ctaleck
    Participant

      I am using the “MessageType” function that I pulled from other examples from Advansys. It produces an error -2147467259 quite frequently with no other information. Is it something I should be worried about or just ignore it in my code.


      Execution Source : esUndefined(6) The applet was executed by an undefined means
      Execution Source Info :
      Error Location : MessageType
      Error Desc :
      Error Number : -2147467259
      Error Source :


      Public Function MessageType(Client)
      On Error Resume Next
      Dim iCount
      Set Msg = Client.ClientState.CommandMessage
      If Not IsObject(Msg) Then
      MessageType = FALSE
      iCount = Client.ClientState.SelectedMessages.Count
      If iCount > 1 then
      MessageType = FALSE
      ElseIf iCount = 1 Then
      Set Msg = Client.ClientState.SelectedMessages.Item(iCount)
      MessageType = TRUE
      End If
      Else
      MessageType = TRUE
      End If
      End Function
    • Author
      Replies
    • #8110
      Support 3
      Participant

        “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

      Viewing 1 replies (of 1 total)
      • You must be logged in to reply to this topic.