Hi
Code:
Private Sub Command15_Click()Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Dim fileName As String, todayDate As String
Dim Date1 As String
Dim Date2 As String
Dim obj As Object
Dim rep As String
Date1 = Format(Text10, "DD-MM-YYYY")
Date2 = Format(Text12, "DD-MM-YYYY")
todayDate = Format(Date, "MMDDYYYY")
'fileName = Application.CurrentProject.Path & "\Performances From " & Date1 & " To " & Date2 & ".pdf"
'DoCmd.OutputTo acReport, "Performances", acFormatPDF, fileName, False
'Email the results of the report generated
Set oEmail = oApp.CreateItem(olMailItem)
With oEmail
.Recipients.Add "user@gmail.com"
.Subject = "Lecturer Performances From " & Date1 & " To " & Date2
.Body = "Dear Staff Members" & vbNewLine & "I here with attach the performane report of lecturers from " & Date1 & " to " & Date2
.Attachments.Add fileName
.Display
'.Send
End With
MsgBox "Email successfully sent!", vbInformation, "EMAIL STATUS"
End Sub
I used above code to send attachment as email, but when i run the code it saves a copy of the report in my desktop. is there is way to remove highlighted area and import the report as pdf from database directly?