• VB and Eudora (VB and Eudora needed)

    Author
    Topic
    #394162

    This thread is for those having Eudora and VB.

    I have tested the code for Eudora both with and without AutoProtect and email
    scanning disabled in Norton Auntie Virus 2003.
    ———————————————————————————-
    I give two sets of code below.

    a. One uses VB with Microsoft Word.
    b. The other uses VB with Eudora.

    You will need to have Eudora to replicate the behavior.

    The only differences between the two sets of code are in the following:

    1. Const strServerName
    2. Dim app
    3. Word uses app.Quit and Eudora uses app.CloseEudora.

    The code works as expected when the target app is not running before
    running the VB code.

    If Word is already running when the VB code is run, the code works as
    expected, i.e., Word is not shutdown.

    However, if Eudora is already running, the VB code performs as expected the
    first time the VB code is run, but running the VB code a second time causes
    Eudora to shut down.

    Can I code around such a problem?

    Is this problem unique to Eudora?
    Is there a property of GetObject that needs to be handled?

    Here’s the two pieces of code:

    '---------------------------------------------------------------------------
    Option Explicit
    Sub main()
        ' If app is not running, create instance of app, do our thing, then close app.
    
        ' If app is already running, do our thing with running instance of app, and
        ' do not close app.
    
        Const strServerName As String = "Eudora.EuApplication.1"
        Dim app As EuApplication
        Dim blnCreated As Boolean
        Dim strPath As String
    
        On Error Resume Next
    
        blnCreated = False
        If app Is Nothing Then
            Set app = GetObject(, strServerName)
            If Err.Number  0 Then
                Err.Clear
            End If
        End If
    
        If app Is Nothing Then
            Set app = CreateObject(strServerName)
            If Err.Number  0 Then
                Err.Clear
            End If
            blnCreated = Not (app Is Nothing)
        End If
    
        If Not (app Is Nothing) Then
            strPath = app.Path
        End If
    
        On Error Resume Next
        If blnCreated Then
            app.CloseEudora
        End If
    
        Set app = Nothing
    End Sub
    '---------------------------------------------------------------------------
    
    Option Explicit
    Sub main()
        ' If app is not running, create instance of app, do our thing, then close app.
    
        ' If app is already running, do our thing with running instance of app, and
        ' do not close app.
    
        Const strServerName As String = "Word.Application"
        Dim app As Word.Application
        Dim blnCreated As Boolean
        Dim strPath As String
    
        On Error Resume Next
    
        blnCreated = False
        If app Is Nothing Then
            Set app = GetObject(, strServerName)
            If Err.Number  0 Then
                Err.Clear
            End If
        End If
    
        If app Is Nothing Then
            Set app = CreateObject(strServerName)
            If Err.Number  0 Then
                Err.Clear
            End If
            blnCreated = Not (app Is Nothing)
        End If
    
        If Not (app Is Nothing) Then
            strPath = app.Path
        End If
    
        On Error Resume Next
        If blnCreated Then
            app.Quit
        End If
    
        Set app = Nothing
    End Sub
    
    Viewing 1 reply thread
    Author
    Replies
    • #720442

      hi Howard,

      i noticed you also posted this to a few newsgroups but did not yet get an adequate response. i’m afraid there’s not much to suggest.
      what you could try is late binding (app as object iso app as euapplication), and leaving out version (.1) in the getobject (and createobject) statements.
      also something to check is wether you the getobject is successful when eudora is already running the 1st time the code is executed, or if it produces an error and the createobject is called erronously.

      this is not the only mail program with ole problems it seems. for instance, lotus notes does not allow early binding, allthough that functionality is provided.

      • #720622

        I was hoping to find someone who would conform that they saw the same behavior with Eudora.
        And yes, the CreateObject is called erroneously due to an error from GetObject the 2nd time the code runs with Eudora already running.

        I even tried disabling AutoProtect and email scanning in Norton Auntie Virus as that would be the most likely source of conflict.

        I used the “.1” in the server name because that is what the example in the Eudora API gave.
        I thought about pulling that out, but have not yet done so.
        I’ll try this and let ya know what happens.

        I started down this pag because I wanted to programmatically convert the Eudora filters to Sieve (see RFC 3028) and eventually to Outlook.

        Of course, the Eudora VB interface does not have filters in its object model, so al lI would achieve by using VB with Eudora is the ability to automatically find the filters file.
        However, I could likely build an Eudora plug-in and do my own filtering.

        I ended up manually creating the Sieve filters.

        • #720631

          Also don’t run Eudora.

          Your procedure is behaving as though Set app = Nothing is not working the first time through. True? You have disabled error handling before that line. It would be interesting to re-enable error handling and also to check for the existence of app the second time on the way in. Maybe something unusual is happening with this particular object reference.

          • #720686

            app is Nothing.

            Error handling is not being disabled.
            Err.Clear does not disable, it just clears.

            • #720711

              > Error handling is not being disabled.

              I was referring to this:

                  On Error Resume Next
                  If blnCreated Then
                      app.CloseEudora
                  End If
                  Set app = Nothing

              But I have no further insights on this.

            • #720751

              The error has always been cleared prior to that point.
              The On Error is there in case an error occurs in app.CloseEudora.

              The problem is that blnCreated gets set to True because the app is erroneously recreated 2nd time when Eudora is already running.

            • #720752

              The error has always been cleared prior to that point.
              The On Error is there in case an error occurs in app.CloseEudora.

              The problem is that blnCreated gets set to True because the app is erroneously recreated 2nd time when Eudora is already running.

            • #720712

              > Error handling is not being disabled.

              I was referring to this:

                  On Error Resume Next
                  If blnCreated Then
                      app.CloseEudora
                  End If
                  Set app = Nothing

              But I have no further insights on this.

          • #720687

            app is Nothing.

            Error handling is not being disabled.
            Err.Clear does not disable, it just clears.

        • #720632

          Also don’t run Eudora.

          Your procedure is behaving as though Set app = Nothing is not working the first time through. True? You have disabled error handling before that line. It would be interesting to re-enable error handling and also to check for the existence of app the second time on the way in. Maybe something unusual is happening with this particular object reference.

      • #720623

        I was hoping to find someone who would conform that they saw the same behavior with Eudora.
        And yes, the CreateObject is called erroneously due to an error from GetObject the 2nd time the code runs with Eudora already running.

        I even tried disabling AutoProtect and email scanning in Norton Auntie Virus as that would be the most likely source of conflict.

        I used the “.1” in the server name because that is what the example in the Eudora API gave.
        I thought about pulling that out, but have not yet done so.
        I’ll try this and let ya know what happens.

        I started down this pag because I wanted to programmatically convert the Eudora filters to Sieve (see RFC 3028) and eventually to Outlook.

        Of course, the Eudora VB interface does not have filters in its object model, so al lI would achieve by using VB with Eudora is the ability to automatically find the filters file.
        However, I could likely build an Eudora plug-in and do my own filtering.

        I ended up manually creating the Sieve filters.

      • #720680

        I tried using Eudora.EuApplication instead of Eudora.EuApplication.1.
        That gets an error eve n if Eudora is already open.

        I also tried on a system with NAV 2002 instead of NAV 2003.
        And on a recently installed clean Win 2000 that has less apps, tho it does have NAV.

        IMHO, Eudora’s implementation is obviously messed up.
        More incentive to move to Outlook, but I’m trying to avoid that as long as possible.

        Using Eudora allows me to use the same mail program on all my partitions on my multiboot system.
        Cannot do that safely with Outlook due to different PST file formats.
        Don’t want to use OE for email, so i’m stuck with Eudora on this system.

        • #720692

          I forgot to mention.

          Both Eudora.EuApplication and Eudora.EuApplication.1 are included in the registry, so either should have worked.

        • #720693

          I forgot to mention.

          Both Eudora.EuApplication and Eudora.EuApplication.1 are included in the registry, so either should have worked.

      • #720681

        I tried using Eudora.EuApplication instead of Eudora.EuApplication.1.
        That gets an error eve n if Eudora is already open.

        I also tried on a system with NAV 2002 instead of NAV 2003.
        And on a recently installed clean Win 2000 that has less apps, tho it does have NAV.

        IMHO, Eudora’s implementation is obviously messed up.
        More incentive to move to Outlook, but I’m trying to avoid that as long as possible.

        Using Eudora allows me to use the same mail program on all my partitions on my multiboot system.
        Cannot do that safely with Outlook due to different PST file formats.
        Don’t want to use OE for email, so i’m stuck with Eudora on this system.

    • #720443

      hi Howard,

      i noticed you also posted this to a few newsgroups but did not yet get an adequate response. i’m afraid there’s not much to suggest.
      what you could try is late binding (app as object iso app as euapplication), and leaving out version (.1) in the getobject (and createobject) statements.
      also something to check is wether you the getobject is successful when eudora is already running the 1st time the code is executed, or if it produces an error and the createobject is called erronously.

      this is not the only mail program with ole problems it seems. for instance, lotus notes does not allow early binding, allthough that functionality is provided.

    Viewing 1 reply thread
    Reply To: VB and Eudora (VB and Eudora needed)

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

    Your information: