Code:
Public Sub Send_Daily_Click()
If (Action_Complete) = False And Date_Closed <> Now Then
Date_Closed = Now
Else
On Error GoTo ErrorMsgs
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookAttach As Outlook.Attachment
Dim strBody, strAddresses, strSubject As String
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.Subject = "Title- " & Format(Date, "dd mmm yyyy")
.Body = "For your use." & vbCrLf & vbCrLf & "V/R" & vbCrLf & vbCrLf & "Name" & vbCrLf & vbCrLf & _
"Org 1" & vbCrLf & "Org 2" & vbCrLf & _
"Addy 1" & vbCrLf & "Addy 2" & vbCrLf & "Phone" & vbCrLf & _
"Email Addy"
DoCmd.OutputTo 3, "Daily Actions", acFormatPDF, "C:\Temp\Daily Actions - " & Format(Date, "dd mmm yyyy") & ".pdf", , 0
.Attachments.Add ("C:\Temp\Daily Actions - " & Format(Date, "dd mmm yyyy") & ".pdf")
'.To = "Adressee"
.Display
DoCmd.Close acReport, "Daily Actions"
Kill "C:\Temp\Daily Actions - " & Format(Date, "dd mmm yyyy") & ".pdf"
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookAttach = Nothing
Exit Sub
ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail " & _
"addresses to send your message."
Else
MsgBox Err.Number & " " & Err.Description
End If
End If
End Sub
Other event put
Code:
Private Sub Send_Daily_Click()
Call Send_Daily_Click
End Sub
When I select the button on the other event nothing happens. If I take out the [Private Sub Send_Daily_Click()] I get an "Invalid Outside procedure"