• What is this error? (VB6)

    Author
    Topic
    #372882

    Is there a way to find out what this error number is?

    -2147352567

    Viewing 0 reply threads
    Author
    Replies
    • #597308

      You need to provide a bit more context.

      The only help I can offer is that if I convert -2147352567 to hex it is 80020009. Searching the Microsoft web site for 80020009 shows lots of different things returning this error code. Knowing how you generated it would let us reduce the list a bit.

      Unfortunately the most likely hit is the article at Q186063 which includes the helpful line…

      -2147352567 (80020009)    Exception occurred. 
      

      StuartR

      • #597572

        Hi Stuart. I read that KB article and put in the code to translate the message. I get several Error not founds, Exception Occurred, an “Operation completed successfully”, and finally “The system cannot find the device specified”. Here is the code making up the class module. The idea is to send an email through Novell Groupwise.

        Dim ogwCmdr As Object ‘(Groupwise Commander, it cannot be early bound)

        Private Declare Function FormatMessage Lib “kernel32” Alias _
        “FormatMessageA” (ByVal dwFlags As Long, lpSource As Long, _
        ByVal dwMessageId As Long, ByVal dwLanguageId As Long, _
        ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Any) _
        As Long

        Public Function SendMail(sTo As String, _
        Optional sMsg As String) As Boolean

        ‘ Comments : Method to send Email transparently through GroupWise
        ‘ Parameters: sTo – Address of Recipient
        ‘ sMsg – Message Text
        ‘ Returns : True if Successful
        ‘ Created : 6/21/2002
        ‘ Source : M. Shea

        Dim objGroupWise As Object ‘for the session
        Dim objAccount As GroupwareTypeLibrary.Account ‘for the login
        Dim objWorkFolder As GroupwareTypeLibrary.Folder ‘for the folder
        Dim objMessage As GroupwareTypeLibrary.Message ‘for the message
        Dim MsgId As String ‘ID of the message created

        On Error GoTo ErrorHandler:

        Set objGroupWise = CreateObject(“NovellGroupWareSession”)
        Set objAccount = objGroupWise.Login
        Set objWorkFolder = objAccount.WorkFolder
        Set objMessage = objWorkFolder.Messages.Add(“GW.MESSAGE.Mail”, egwDraft)

        MsgId = objMessage.MessageID

        ‘start up the Groupwise Commander
        ‘ Set ogwCmdr = CreateObject(“GroupwiseCommander”)

        ””””””””””””””””””””””””””””””””””””””””””
        ‘Pass the arguments so they can be executed.
        ”””””””””””””””””””””””””””””””””””””””””’

        Debug.Print “Carriage Return at: ” & InStr(1, sMsg, vbCrLf, vbBinaryCompare)
        Debug.Print “Line Feed at: ” & InStr(1, sMsg, vbLf, vbBinaryCompare)
        Debug.Print “Carriage Return at: ” & InStr(1, sMsg, vbCr, vbBinaryCompare)
        Debug.Print “New Line at: ” & InStr(1, sMsg, vbNewLine, vbBinaryCompare)
        Debug.Print “Null Char at: ” & InStr(1, sMsg, vbNullChar, vbBinaryCompare)
        Debug.Print “Null String at: ” & InStr(1, sMsg, vbNullString, vbBinaryCompare)
        Debug.Print “Tab at: ” & InStr(1, sMsg, vbTab, vbBinaryCompare)
        Debug.Print “Back at: ” & InStr(1, sMsg, vbBack, vbBinaryCompare)

        sMsg = BToker(sMsg, vbCrLf, ” “)

        sMsg = BToker(sMsg, vbLf, ” “)

        sMsg = BToker(sMsg, vbCr, ” “)

        sMsg = BToker(sMsg, vbNewLine, ” “)

        sMsg = BToker(sMsg, vbNullChar, ” “)

        ‘ sMsg = BToker(sMsg, vbNullString, ” “) ‘Yeah, this was a cluster

        sMsg = BToker(sMsg, vbTab, ” “)

        sMsg = BToker(sMsg, vbBack, ” “)

        With objMessage

        .Recipients.Add sTo
        .Subject.PlainText = vbTab
        .BodyText.PlainText = Trim$(sMsg) & ” ”
        .Send

        End With

        ‘Set ogwCmdr = Nothing

        Exit_SendMail:

        Set objGroupWise = Nothing
        Set objAccount = Nothing
        Set objWorkFolder = Nothing
        Set objMessage = Nothing

        ErrorHandler:

        MsgBox “Error: ” & MessageText(Err.Number)

        SendMail = False

        Resume Next

        ‘Resume Exit_SendMail:

        End Function

        Private Function MessageText(lCode As Long) As String
        Dim sRtrnCode As String
        Dim lRet As Long

        sRtrnCode = Space$(256)
        lRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, lCode, 0&, _
        sRtrnCode, 256&, 0&)
        If lRet > 0 Then
        MessageText = Left(sRtrnCode, lRet)
        Else
        MessageText = “Error not found.”
        End If

        End Function

        Public Function BToker( _
        sTextIn As String, _
        sFind As Variant, _
        sReplace As String) _
        As String
        ‘ Comments : Replaces a substring in a string with another
        ‘ Parameters: sTextIn – String to work on
        ‘ sFind – String to find
        ‘ sReplace – String to replace with
        ‘ Returns : Modified string
        ‘ Source : M. Shea

        Dim sTmp As String
        Dim lPos As Long

        On Error GoTo PROC_ERR

        sTmp = sTextIn
        ‘ Find the first occurrence
        lPos = InStr(1, sTmp, sFind, vbTextCompare)

        Do While lPos > 0
        ‘ Replace the found string
        sTmp = Left$(sTmp, lPos – 1) & _
        sReplace & _
        Mid$(sTmp, lPos + Len(sFind))
        ‘ Find the next occurrence
        lPos = InStr(lPos + Len(sReplace), _
        sTmp, _
        sFind)
        Loop

        ‘ Return the value
        BToker = sTmp

        PROC_EXIT:
        Exit Function

        PROC_ERR:
        MsgBox “Error: ” & Err.Number & “. ” & Err.Description, , _
        “ReplaceString”
        Resume PROC_EXIT

        End Function

        • #597599

          Can you single step the code, or add some debug output, so you know which line is generating the error?

          I remembered a recent thread where someone posted an example of how to use Groupwise from VBA, but when I searched for it just now I see it was you – so there’s little point in suggesting you read Post 150045.

          StuartR

          • #597607

            Yes, actually, that was me. In fact, this is the same code that was working and all of a sudden stopped. The only thing I did was recompile it so that it pointed to the back end on another server. Since then I can’t get it to work past the Account.Login object (which I found by stepping through the code). The specific line is

            Set objAccount = objGroupWise.Login

            Obviously, I don’t believe the change in the connection object has anything to do with the API call in the class module. It populates the form just fine.

            • #597613

              How many times have I started a sentence with “The only thing I changed was…”

              Do you still have the original code?
              Does it still work?
              Did you have exactly the same environment when you recompiled it?
              Does the original code still work if you recompile it with no changes?

              StuartR

            • #597676

              I know what you’re saying, and I’m sure you heard that a million times, but I used the application in development just prior to making the modification, made the path change, then compiled it. Actually, I’m not discounting what your saying, I just don’t know where could have possibly occurred.

              I didn’t make a backup of the original code yet (no excuse), but I did take an image of my entire system two days ago before the change. I am going to save my existing code to a floppy and restore the image.

              To your credit, I admit there HAS to have been something I did or missed and have a feeling the code will work when I restore the image.

            • #597866

              Over night I was thinking of your questions and what changes I might have made. I recalled that I had been working with Microsoft tech support to install VB.NET (problem was installation wouldn’t even start). They had me delete a key: HKLMSoftwareMicrosoftWindows NTCurrentVersionImage File Execution Options. I reimported this key from a backup and it still didn’t work. I plan to do restore the image on my PC this afternoon.

            • #597890

              > I plan to do restore the image on my PC this afternoon.

              Good luck.

              StuartR

            • #598117

              Stuart,

              I restored the image and the program worked just fine. So I went through step by step making the modifications as I did before, testing each and every thing. This will come as an extreme shock to you. I did, in fact, make a modification I didn’t tell you about. I put error handling in the Click event that called the COM method I created. Well, what I failed to do (and I am now part of the club that has done this at least once) is put an Exit Function in the method, so it just passed right on through into the error handling and ultimately returned False.

            • #598119

              Thank you for making me smile – we’ve all been there and done that!

              I’m pleased you managed to work this out – it can be really difficult to remember every change you make. It helps you realise why major software vendors can never produce perfect code.

              StuartR

    Viewing 0 reply threads
    Reply To: What is this error? (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: