Code not working (1 Viewer)

Ravi Kumar

Registered User.
Local time
Today, 21:19
Joined
Aug 22, 2019
Messages
162
Can anyone please tell me what did I missed in the below, it is coming as syntax error.
Code:
Private Sub cmdmailppm_Click()
DoCmd.SendObject acSendReport, "PPM table", acFormatPDF, "Sanjay.Joseph@plansee.com" & ";" & "Ramandeep.Singh@plansee.com", "Prabha.Tirupatiananthachar@plansee.com", , "PPM Trend", "Dear all" & vbCrLf & "Please refer the attached file for the ppm trend" & vbCrLf & "Thank you" & vbCrLf & "Abishek"
On Error GoTo errmsg
errmsg:  MsgBox("Last action was Cancelled", vbOKOnly, "mail not sent")
End Sub
 

Micron

AWF VIP
Local time
Today, 11:49
Joined
Oct 20, 2018
Messages
3,476
Always let us know which line produces the error. I think you are missing a comma
, , ,"PPM Trend",
Also, if the error line executes, it should also produce an error (so that's why knowing which line you are asking about is important).
Don't wrap the message box parameters in parentheses unless it is returning a value.
 

June7

AWF VIP
Local time
Today, 07:49
Joined
Mar 9, 2014
Messages
5,423
Actually, if that last email is supposed to be for CC, then commas are correct.

I don't see syntax error with SendObject line. The concatenation is not necessary. Can just type the 2 addresses as a single semi-colon separated string.

The parens do cause compile error. Running the code regardless will return Syntax Error.
 
Last edited:

Micron

AWF VIP
Local time
Today, 11:49
Joined
Oct 20, 2018
Messages
3,476
The list separator is a Regional settings thing so it may be wrong. Anyway, that's it for me tonight. Time for OP to weigh in.
 

Users who are viewing this thread

Top Bottom