A
Andy Roberts
I have a form with a txt box (txtClientRepEmail) which holds an email
address and I have a cmd buttonwhich creates an email using outlook using
the following code:-
Private Sub cmdSendEmail_Click()
Dim Email As String
Dim ref As String
Dim origin As String
Dim destination As String
Dim Notes As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Email = Me!txtClientRepEmail
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Email
.Display 'sends the email in Outlook. Change to DISPLAY if you want to
be able to
'modify or see what you have created before sending the email
End With
objOutlook.Quit
Set objEmail = Nothing
End Sub
The code breaks on the "Email = Me!txtClientRepEmail" line and I can't
understand why and as a separate issue, in the message created the
receipients address line is displayed as :
(e-mail address removed)#mailto:[email protected]# and not just
(e-mail address removed)
--
Regards
Andy
___________
Andy Roberts
Win XP Pro
Access 2007
address and I have a cmd buttonwhich creates an email using outlook using
the following code:-
Private Sub cmdSendEmail_Click()
Dim Email As String
Dim ref As String
Dim origin As String
Dim destination As String
Dim Notes As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Email = Me!txtClientRepEmail
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Email
.Display 'sends the email in Outlook. Change to DISPLAY if you want to
be able to
'modify or see what you have created before sending the email
End With
objOutlook.Quit
Set objEmail = Nothing
End Sub
The code breaks on the "Email = Me!txtClientRepEmail" line and I can't
understand why and as a separate issue, in the message created the
receipients address line is displayed as :
(e-mail address removed)#mailto:[email protected]# and not just
(e-mail address removed)
--
Regards
Andy
___________
Andy Roberts
Win XP Pro
Access 2007