Results 1 to 9 of 9
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB and Eudora (VB and Eudora needed)

    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:
    <pre>'---------------------------------------------------------------------------
    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
    </pre>


  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and Eudora (VB and Eudora needed)

    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.

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and Eudora (VB and Eudora needed)

    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.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: VB and Eudora (VB and Eudora needed)

    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.

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and Eudora (VB and Eudora needed)

    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.

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and Eudora (VB and Eudora needed)

    app is Nothing.

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

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and Eudora (VB and Eudora needed)

    I forgot to mention.

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

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: VB and Eudora (VB and Eudora needed)

    > Error handling is not being disabled.

    I was referring to this:
    <pre> On Error Resume Next
    If blnCreated Then
    app.CloseEudora
    End If
    Set app = Nothing</pre>

    But I have no further insights on this.

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and Eudora (VB and Eudora needed)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •