I have VBA code to send an Outlook email with a pdf attached from Excel.
I am trying to disable the Outlook attachment context menu that allows saving, printing, etc. the attachment.
Is this possible within Excel VBA?
I want for the attachment to open in read mode and for the user not be able to save it.
Sub SendDMR()
'some code not added for simplicity
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ""
.SentOnBehalfOfName = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "Daily Management Report " & Format(Date - 1, "dd/mm/yyyy")
.Body = "Good morning," & vbCr & vbCr & "Please find the Daily Management Report attached for " & Format(Date - 1, "dd/mm/yyyy") & "." & vbCr & vbCr & "Kind regards," & vbCr & vbCr & "Shift Trading Team" & vbCr & "SSE Gas Storage" & vbCr & "Inveralmond House, Perth" & vbCr & "T: +44 (0)1738 453960" & vbCr & "E: [email protected]"
.Attachments.Add strPath & strFName
.Permission = olDoNotForward
.PermissionService = olWindows
.Sensitivity = olConfidential
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
Exit Sub
MsgEnd:
MsgBox "Please set the print area before continuing", vbExclamation
End Sub