Hi everyone!
Hope you are all great. I am in a rush and I need help urgently. I have created an access database that sends e-mails to certain list of people. This email is on HTML body and it works just fine, however there are a few things I cannot accomplish and that I have search in the web with no success.
Here are my questions:
1) How can I make to leave a space between paragraph and paragraph? I have tried several things ( Dim lStr As String,lStr = "", lStr = lStr; &_ " ") and none worked. Do you have any ideas?
2) On the questions part I would need them to be on bold, how can do that
3) And last but not least between the Code element and the prahase "Pay period" there is a paragraph when I want them to be all together in a same line.}
This is my code:
Hope you are all great. I am in a rush and I need help urgently. I have created an access database that sends e-mails to certain list of people. This email is on HTML body and it works just fine, however there are a few things I cannot accomplish and that I have search in the web with no success.
Here are my questions:
1) How can I make to leave a space between paragraph and paragraph? I have tried several things ( Dim lStr As String,lStr = "", lStr = lStr; &_ " ") and none worked. Do you have any ideas?
2) On the questions part I would need them to be on bold, how can do that
3) And last but not least between the Code element and the prahase "Pay period" there is a paragraph when I want them to be all together in a same line.}
This is my code:
Code:
Private Sub Command252_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim MyForm As Form
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String
Dim lStr As String
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("APFAM")
MyRS.MoveFirst
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![Enterprise]
With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olBCC
lStr = ""
' Set the Subject, the Body, and the Importance of the e-mail message.
.To = MyRS![Enterprise]
.Subject = "URGENT ACTION REQUIRED - US Business Travel Policy Request"
.HTMLBody = "<html><body><font face=calibri> Dear Assignee, <BR> Our records indicate that although you have entered the United States as a Business Visitor, you used a chargeable WBS element,</font></body></html>" & MyRS![WBSE] & "," & "<html><body><font face=calibri> during pay period 30/11/2012</font></body></html>" & _
"<html><body><font face=calibri> Why am I receiving this e-mail? <BR> When a non-US employee comes to the US for business travel (i.e., meetings, classroom training or knowledge transfer), all time and expenses must be charged to an internal, non-chargeable WBS element. Chargeable WBS elements in the home or host company code may not be used for business travel, as described in the US Immigration Policy. Corrective actions by you are needed as noted below.</font></body></html>" & _
"<html><body><font face=calibri> How do I know if a WBS is appropriate for business travel? <BR> If a WBS is identified as chargeable on the myTE Assignments tab, it cannot be used by a B-1 visa holder or business visa waiver traveler while in the US. Please view document attached for your reference</font></body></html>" & _
"<html><body><font face=calibri> What action is required? <BR> Please stop using a chargeable WBS element for the rest of the current trip, and for all future business trips in the US. Failure to follow this policy in the future may lead to disciplinary action. </font></body></html>" & _
"<html><body><font face=calibri> Who do I contact for more information? <BR> Please contact People Mobility:<BR>Customer Service: Contact numbers and hours of service can be found at: https://sites.accenture.com/publishing/GlobalMobilityandRelocationNavigator/Pages/ContactList.aspx <BR>myRequests: You can submit and check the status of inquiries online at any time by visiting https://myrequests.accenture.com </font></body></html>" & _
"<html><body><font face=calibri> We appreciate your prompt attention to this matter.<BR>Regards,<BR>LUCILA PLÄNICH<BR>People Mobility Service Delivery </font></body></html>"
.Importance = olImportanceHigh 'High importance
' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub