Hi,
We have a working module in MsAccess which code is for sending email thru Outlook. What we have done is when a "Generate Email" button is clicked, it will call the email module whose function is to create an email thru outlook. We will then choose manually which E-mail account to use and then we send it.
Is there a way to pre-select the E-mail account to use so that we don't need to manually choose?
Below is our simple code:
Public Function SendEMail()
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
Dim MyBodyText As String
Subjectline$ = "Test"
MyBodyText = "<table border='0'style='font-family: Arial; font-size:13'><tr><td></td></tr>"
MyBodyText = MyBodyText & "<tr><td>Body of Msg</td><td width='100' align='center'>:</td><td>" & Form_Test.Body & "</td></tr>" & "<tr><td colspan='3' height='25'></td></tr>"
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = "me@yahoo.com"
MyMail.Subject = Subjectline$
MyMail.HTMLBody = MyBodyText
MyMail.Display
Set MyMail = Nothing
Set MyOutlook = Nothing
End Function
Thanks
We have a working module in MsAccess which code is for sending email thru Outlook. What we have done is when a "Generate Email" button is clicked, it will call the email module whose function is to create an email thru outlook. We will then choose manually which E-mail account to use and then we send it.
Is there a way to pre-select the E-mail account to use so that we don't need to manually choose?
Below is our simple code:
Public Function SendEMail()
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
Dim MyBodyText As String
Subjectline$ = "Test"
MyBodyText = "<table border='0'style='font-family: Arial; font-size:13'><tr><td></td></tr>"
MyBodyText = MyBodyText & "<tr><td>Body of Msg</td><td width='100' align='center'>:</td><td>" & Form_Test.Body & "</td></tr>" & "<tr><td colspan='3' height='25'></td></tr>"
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = "me@yahoo.com"
MyMail.Subject = Subjectline$
MyMail.HTMLBody = MyBodyText
MyMail.Display
Set MyMail = Nothing
Set MyOutlook = Nothing
End Function
Thanks