Greetings Experts,
I have a maintenance file that includes a "save" button that saves the file and sends two people emails telling them that the file has had an addition. I have the network address included in the body of the email, but I would like to just click on the address and be able to access the file from the email. Here is the macro I currently have;
Sub Mail_small_Text_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "A new maintenance item has been added to the Maintenance Log. You can view this file at Y:\Common\Facilities Maintenance\Fac Maint Log.xlsm "
*** this is the line that I would like to fix so the file location is a link***
On Error Resume Next
With OutMail
.To = "Rob Cummings <rcummings@grwater.com>; Glen Ray <gray@grwater.com>"
.CC = ""
.BCC = ""
.Subject = "A maintenance item has been added to the Maint Log"
.Body = strbody
.Send
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End With
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save As...").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save").Enabled = False
ActiveWorkbook.Save
End Sub
I think you may consider to remove the line of code: On Error Resume Next and to have a better error handling in your Sub.
if you put the On Error Resume Next in it, the script will keep running, and you will not be notified if that's any errors in sending out the emails.