Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    opening Outlook when they've forgotten (Access 97 SR-2)

    My users want me to, once again, make their application perfect. Right now it sends out an email after they make a change to what they think their customers will be buying; unfortunately, it requires that Outlook be open first and, for reasons known only to them, they sometimes neglect to open Outlook before they go into the application.

    I have built into the VBA code a section that looks to see if Outlook is open or not and this works well; I just can't figure out what to use to open outlook if it isn't open to begin with. My borrowed function is as follows:
    ............................
    Function isAppRunning(appName) As Boolean
    On Error Resume Next
    Dim app As Object
    isAppRunning = True
    Set app = GetObject(, appName)
    If Err.number <> 0 Then
    isAppRunning = False
    End If
    -------------------------------------

    So when I call this function, here's what I want to do:

    If isAppRunning("outlook.application") = False Then
    'open the application - here's where I don't know what to do

    Else
    'outlook is open and we go on our merry way
    End If

    Any suggestions? <img src=/S/help.gif border=0 alt=help width=23 height=15>

    I think I need to do CreateObject("Outlook.Application") but I don't know how to call this or if I need to DIM something.

    Thanks!
    Carpy Diem, it&#39;s .

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Try the following:

    Shell("outlook.exe")

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Thanks, Patt! It worked great! Now if I can get them to turn on their p.c. first before they start complaining... <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>
    Carpy Diem, it&#39;s .

  4. #4
    New Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    That would be: fingers("flick switch")
    Sounds like you might just about be ready to start learning some OO programming moves

    Dr Godfrey Nicholson
    Ofek Technologies Ltd
    Auckland, NZ (the hub of the Pacific, aka "Middle Earth")

  5. #5
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    The method for doing this with Automation is about as simple:
    Dim objOutlook as Outlook.Application
    Set objOutlook = CreateObject("Outlook.Application")

    There are some advantages to doing it this way if you have other things you want to do, such as create a Task, a Contact or an eMail. It's a little intimidating at first, but very powerful.
    Wendell

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Hi Wendell,

    If I try that in Access97 I get a compile error:
    "User-defined type not defined"

    Am I not doing something I should?

    Pat

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Ah yes - I should have mentioned the references issue. You need to set a reference in VBA to the Outlook Object Model - I think Outlook98 is version 8. You do that with a module (of any type) open in the editor, and do Tools/References. Too much snow here today I guess.
    Wendell

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Actually, Outlook 98 was version 8.5. The Outlook object library is either "Msoutl8.olb" (Outlook 97 ) or "Msoutl85.olb" (Outlook 98).
    Charlotte

  9. #9
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    So by doing

    Set objOutlook = CreateObject("Outlook.Application")

    it's more efficient than doing

    Shell ("outlook.exe")

    if the user doesn't have Outlook open?

    My application is complicated enough so I'd like it to run as efficiently as possible. I wish the users would open Outlook first, but short of slapping their hands two to three times a day, I can't get them to get into the habit.

    So you got all our snow - I wondered what happened...
    Carpy Diem, it&#39;s .

  10. #10
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    I didn't mean to suggest that using Automation was more efficient than using the Shell command. It probably isn't, but what it does give you is greater control over what happens with Outlook. For example, you can create a complex email message, even using HTML if appropriate in the Body. You can also create Tasks with reminders, or mark existing Tasks complete. We have an application that uses those facilities, and we do a check to see if Outlook is running when we start the database and if not we create the Outlook object. Then on database close, if we opened it, we close it. Hope this makes sense, but it's kind of early here.

    What a difference a few days make. Highs in the 60s today, and all our snow is on the way to Nebraska, Kansas and Oklahoma.
    Wendell

  11. #11
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Thanks, Wendell. The application I'm attempting to finalize is pretty complicated with new issues every day and I'm beginning to think they want it to walk down the hall to their office and ask "how's it going?" several times a day. So thinking on the greater control issue, I'll probably go with the automation.

    We're having a "heat wave" up here in MN - might even get up to 30! <img src=/S/groovin.gif border=0 alt=groovin width=21 height=21>
    Carpy Diem, it&#39;s .

  12. #12
    Star Lounger
    Join Date
    Jan 2001
    Location
    Duesseldorf, Germany
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Could you please have a look on my posting from today "Automation Excel" ??
    <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  13. #13
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: opening Outlook when they've forgotten (Access 97 SR-2)

    Sorry for the delay - I had a sample I wanted to examine that is at the client I am currently visiting. In the meantime Rory appears to have given you most of what you need. You might want to look at some of the "How To" white papers on the MS Knowledge base that deal with automation and Excel. There is also some excellent material in "The Access Developers Handbook". As to eliminating the prompt about saving on close, I believe there is an option on the Close command that will eliminate the prompt. Good luck - it's a very powerful tool.
    Wendell

Posting Permissions

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