Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emailing through Outlook 2007 Help!!

Status
Not open for further replies.
Nov 29, 2006
11
US
I'm pretty new to visual basic and need a little help figuring out this problem. I'm currently using Access 07 and Outlook 07. I have a button on a form that when clicked will send a email message through Outlook to certain recipients. The problem I'm having is that I have Outlook being created every time the button is clicked. It works fine when Outlook has not been opened yet, but when it is already opened and minimized the code will create another session of Outlook. My question is this; Is there any way to check to see if Outlook is currently running and if it isn't create another session but if it is not to create another session? Thanks!
 
I meant in the last part that Access will check to see if Outlook is running and if it is not it will create a session and if it is to leave it alone and not create anything. Thanks!
 
Can you put the code you're using into your next post? It appears (to me...) that its launching Outlook then sending the e-mail.
 
You can use GetObject with a running application:

Code:
On Error Resume Next
Set oApp = GetObject(, "Outlook.Application")

If Err.Number <> 0 Then
    Set oApp = CreateObject("Outlook.Application")
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top