Hi all,
Below is the code that i have and it works nicely, however, i would like the option to add a "Send As" or make use of the "From" function in outlook...
Code:
Private Sub btn_EmailSW_Click()On Error GoTo ErrorHandler
Dim strTempNew As String
Dim strOld As String
Dim strTo As String
Dim strFrom As String
Dim strSubject As String
Dim strMessageText As String
Dim LResponse As Integer
strFrom = "mypicked@email.here"
strTo = ""
strSubject = ""
strMessageText = "hi there!"
vbNewLine & vbNewLine & _
"Another line here" & _
vbNewLine & vbNewLine & _
"Signature here"
DoCmd.OpenReport "my.report", acViewPreview
DoCmd.SendObject ObjectType:=acSendReport, _
ObjectName:="my.report", _
OutputFormat:=acFormatPDF, _
From:=strFrom, _
To:=strTo, _
Subject:=strSubject, _
MESSAGETEXT:=strMessageText, _
EditMessage:=True
DoCmd.Close acReport, "my.report"
ErrorHandler:
Select Case Err 'specific Case statements for errors we can anticipate, the "Else" catches any others
Case 2501 'Action OpenReport was cancelled.
MsgBox "Ranged Log Inquiry Cancelled"
End Select
DoCmd.Close acReport, "my.report"
End Sub
I keep coming across a "Compile Error: Named argument not found" and is aimed at "From:=".
Any suggestions?