Private Sub cmdEmailReport_Click() Dim strPrevMnth As String Dim strCurrMnth As String Dim strPathName As String Dim strRptName As String Dim strEMRecipients As String Dim strEMCCRecipients As String Dim strEMSubject As String Dim strEMBody As String Dim strEMAttach As String 'Dates for Report Name strPrevMnth = Format(DateSerial(Year(Date), Month(Now), 0), "MMM DD, YYYY") strCurrMnth = Format(Now() - 1, "MMM DD, YYYY") 'Email Recipients strEMRecipients = "email@example.com" strEMCCRecipients = "firstname.lastname@example.org" 'Email Subject strEMSubject = "Attorney Monthly Hours Report" 'Email Body strEMBody = "Please find attached the Attorney Monthly Hours Report as of 3/8/2016." 'Path and Report Name 'strPathName = "H:\NRTEcho\ACTIVE\gdunn59\Atty Monthly Hours Report (WIP - Automate Email)\" strPathName = "H:\NRTEcho\ACTIVE\gdunn59\" strRptName = "Attorney Fiscal YTD Hrs Report Through " & strPrevMnth & " as of " & strCurrMnth & " - Full" & ".pdf" 'strRptName = "Attorney Fiscal YTD Hrs Report Through " & strPrevMnth & " as of " & strCurrMnth & " - Full" 'Report strEMAttach = strPathName & strRptName 'Send Report via Email Set Mail_Object = CreateObject("Outlook.Application") Set Mail_Single = Mail_Object.CreateItem(0) With Mail_Single .Subject = strEMSubject .To = strEMRecipients .cc = strEMCCRecipients .BCC = "" .Body = strEMBody .Attachments.Add (strEMAttach) .send End With debugs: 'If Err.Description "" Then MsgBox Err.Description End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE