Created
January 29, 2019 04:46
-
-
Save logic2design/7c752f9c119f7233ef69542391f92024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub Command66_Click() | |
Const strParent = "\\prod.atonet.gov.au\atonetshares$\Individuals_Automation\Requests\Output\" | |
Dim olApp As Object | |
Dim objMail As Object | |
Dim strID As String | |
Dim strDate As String | |
Dim strOfficer As String | |
Dim strFolder As String | |
Dim strRisk As String | |
Dim strUserID As String | |
On Error Resume Next 'Keep going if there is an error | |
' Request | |
strTitle = Me.Title | |
strID = Me.ID | |
strDate = Me.Request_Date | |
strOfficer = Me.Officer | |
strRisk = Me.Request_Risk | |
strUserID = Me.Officer_UserID | |
' Full path | |
strFolder = "<a href='" & strParent & strOfficer & "\" & strID & " - " & strRisk & " - " & strTitle & "'>Results</a>" | |
strBody = "<html><body><p>Hi,</p><p>Please find at the link below the results of your data request.</p>" _ | |
& strFolder & "<p>Any queries please let me know.</p>Regards</body></html>" | |
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open | |
If Err Then 'Outlook is not open | |
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook | |
End If | |
'Create e-mail item | |
Set objMail = olApp.CreateItem(olMailItem) | |
With objMail | |
.Display | |
'Set body format to HTML | |
.BodyFormat = olFormatHTML | |
.To = strUserID | |
.Subject = strID & " " & strOfficer & " - " & strRisk & " - " & strTitle | |
.htmlBody = strBody & .htmlBody | |
.send | |
End With | |
'MsgBox "Results email has been sent" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment