My goal is to send Email thru Outlook from MS Access utilizing certain fields in my form. I am testing the concept with the following code:
Code:
Private Sub Send_Info_Click()
Dim Email As String
'**create variables for Outlook
Dim objOutlook As Object
Dim objEmail As Object
'**gathers information from your form. this sets the string variable to your fields
Email = Me!Email
'***creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
'***creates and sends email
With objEmail
.To = Email
.Body = "TESTING INSERTING TEXT IN BODY OF EMAIL"
.Display 'SEND 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
'**Closes Outlook
'**objOutlook.Quit
'**Set objEmail = Nothing
Exit Sub
'****end code****
End Sub
The issue I am running into is that the Email field is saves as a Data Type "Hyperlink". I have done this because sometimes I just want to send an email easily without additional text. It causes a problem with the above code as my email looks like this once it opens up the mail client:
Code:
someemail@yahoo.com#mailto:someemail@yahoo.com#
Is there a way to truncate it to remove everything between the # marks?
Also my auto signature does not appear. Is there a switch for this?