Results 1 to 6 of 6
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Checking reference (97 sr2)

    I am currently designing a form which when completed the user can press a command button and it will be sent to a recipient. I am using the sendmail and using the outlook.application method ( The reason is that I have a large number of branch offices which do not use outlook loaded preferring to use exchange instead)

    I have written a piece of VBA in which it will primarily be sent via outlook (if it is loaded), if not then by the sendmail option. This code works fine on my machine (outlook references installed) but on a testmachine (with only exchange) it comes up with a compile error( as the outlook reference is missing.)

    Question:
    What code can be used that checks if outlook is loaded, if so,send the object via outlook , if not by the exchange part of my code?
    Jerry

  2. #2
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Checking reference (97 sr2)

    Jezza,

    The best way would be to put the following line of code in your on click sub:

    if len(dir("Crogram filesmicrosoft officeofficemsoutl8.oct"))<0 then
    'run sub which sends to exchange
    else
    'run sub which sends to outlook
    endif

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Checking reference (97 sr2)

    Excellent, Cindy

    Just a small thing , I think it should be <1 in the length test

    but otherwise a brilliant way of getting around the problem <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Jerry

  4. #4
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Checking reference (97 sr2)

    Jezza do some further testing I do believe it should be 0

  5. #5
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Checking reference (97 sr2)

    Sorry it is actually my fault, lets say typo. Try the following

    if len(dir("Crogram filesmicrosoft officeofficemsoutl8.olb"))=0 then
    'run sub which sends to exchange
    else
    'run sub which sends to outlook
    endif

  6. #6
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Checking reference (97 sr2)

    Yep

    That's cracked it
    Jerry

Posting Permissions

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