Confusing title....I'm sorry. I have the below VBA code attached to a command that exports a report to Outlook and inputs a preset subject line and message. Anything that I want to edit the preset subject or message, I need to directly edit the VBA. Which means everyone needs to exit the DB. It's somewhat of a hassle.
I was wondering if anyone has any suggestions on how to improve. Perhaps make a table and then reference the table fields in the email VBA? And then edit the table fields whenever I need to update?
Code:
Private Sub btnEmailReport_Click()
On Error GoTo btnEmailReport_Click_Err
Dim ReportName As String
Dim Subject As String
Dim ToRecipient As String
Dim CCRecipient As String
Dim BCCRecipient As String
Dim Message As String
ReportName = "rptEmailReport"
Subject = "Email Report"
ToRecipient = "jsmith@gmail.com" & "; " & "pjohnson@gmail.com
CCRecipient = ""
BCCRecipient = ""
Message = "Hello"
btnEmailReport_Click_Exit:
Exit Sub
btnEmailReport_Click_Err:
If Err = 2501 Then
Else
MsgBox "Error #" & Err.Number & " - " & Err.Description, , "RMIS Error"
End If
Resume btnEmailReport_Click_Exit
End Sub