G
Guest
I have successfully created some code that enables me to double click an
email address in a field on a form wich opens our default email programme
(Outlook) and drops the address into the To: field. It also adds a subject
line and some copy to the body if this is passed to the proceedure.
However I would like to always use the default signature that we have set
which shows fine when working directly in Outlook.
Any suggestions?
Code so far is:
Private Sub txtEmail_DblClick(Cancel As Integer)
SendEmail (txtemail)
End Sub
Public Sub SendEmail(Optional strEmailAdd As String, Optional strSubject As
String, Optional strBody As String)
Dim oOutlook As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem
Set oOutlook = New Outlook.Application
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
Set oMailItem = oOutlook.CreateItem(olMailItem)
Dim sEmailString As String
Dim sSubject As String
Dim sBody As String
sEmailString = strEmailAdd
sSubject = strSubject
sBody = ReturnUserName
With oMailItem
.To = sEmailString
.Subject = sSubject
.Body = strBody
End With
oMailItem.Display
Set oOutlook = Nothing
Set oNameSpace = Nothing
Set oMailItem = Nothing
End Sub
email address in a field on a form wich opens our default email programme
(Outlook) and drops the address into the To: field. It also adds a subject
line and some copy to the body if this is passed to the proceedure.
However I would like to always use the default signature that we have set
which shows fine when working directly in Outlook.
Any suggestions?
Code so far is:
Private Sub txtEmail_DblClick(Cancel As Integer)
SendEmail (txtemail)
End Sub
Public Sub SendEmail(Optional strEmailAdd As String, Optional strSubject As
String, Optional strBody As String)
Dim oOutlook As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem
Set oOutlook = New Outlook.Application
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
Set oMailItem = oOutlook.CreateItem(olMailItem)
Dim sEmailString As String
Dim sSubject As String
Dim sBody As String
sEmailString = strEmailAdd
sSubject = strSubject
sBody = ReturnUserName
With oMailItem
.To = sEmailString
.Subject = sSubject
.Body = strBody
End With
oMailItem.Display
Set oOutlook = Nothing
Set oNameSpace = Nothing
Set oMailItem = Nothing
End Sub