I am not real experienced with 2007 at this point. I am double clicking an email text box to open up Outlook. The code does everything I want it to do except when I send the email and close Outlook I am finding out that it doesn't really close Outlook. After returning to my form everything is Ok with the form. If I try and open up Outlook again it won't open unless I reboot the computer.
The following code is what I am using. It seems to work fine in 2003. I am at work with a Access 2003 so any help I will need to try it after work at home.
Private Sub C1Email_DblClick(Cancel As Integer)
On Error GoTo Err_C1Email_DblClick
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim EmailAddress As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Forms(1).C1Email.SetFocus
EmailAddress = Forms(1).C1Email.Text
With OutMail
.To = EmailAddress
.CC = ""
.BCC = ""
.Subject = ""
.Body = ""
.Display 'or when your ready to really email use .Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
Exit_C1Email_DblClick:
Exit Sub
Err_C1Email_DblClick:
MsgBox Err.Description
Resume Exit_C1Email_DblClick
End Sub
The following code is what I am using. It seems to work fine in 2003. I am at work with a Access 2003 so any help I will need to try it after work at home.
Private Sub C1Email_DblClick(Cancel As Integer)
On Error GoTo Err_C1Email_DblClick
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim EmailAddress As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Forms(1).C1Email.SetFocus
EmailAddress = Forms(1).C1Email.Text
With OutMail
.To = EmailAddress
.CC = ""
.BCC = ""
.Subject = ""
.Body = ""
.Display 'or when your ready to really email use .Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
Exit_C1Email_DblClick:
Exit Sub
Err_C1Email_DblClick:
MsgBox Err.Description
Resume Exit_C1Email_DblClick
End Sub