![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I need to auto include yesterday's date into an emailed message TextBody. I've tried using getdate() but it didn't work. Is there someway to incorporate it into the function below? Help please? '************************************************* ******************** * ' Visual Basic ActiveX Script '************************************************* ******************** *** Function Main() 'References to Excel dim xl_app dim xl_Spreadsheet SET xl_app = CREATEOBJECT("Excel.Application") 'SET xl_app = GetObject("\\mongoReport.xls") SET xl_spreadsheet = xl_app.Workbooks.Open("mongoReport.xls") 'Run the macro xl_app.Run("transform_macro") xl_spreadsheet.Save xl_spreadsheet.Close xl_app.Quit set xl_app = Nothing sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = CreateObject("CDO.Configuration") With cdoConfig.Fields .Item(sch & "sendusing") = 2 ' cdoSendUsingPort .Item(sch & "smtpserver") = "qarelay1" .update End With Set cdoMessage = CreateObject("CDO.Message") With cdoMessage Set .Configuration = cdoConfig .From = "reporter (AT) acme (DOT) com" .To = "mongomadness (AT) acme (DOT) com" .Subject = "Automated Report For Today" .TextBody = "Your daily dose of Mongomadness Report.These reports are for files recieved on (NEED YESTERDAY'S DATE HERE). Please do not reply to this message, you will not get a response." .AddAttachment ( "\\mongoReport.xls") .Send End With Set cdoMessage = Nothing Set cdoConfig = Nothing Main = DTSTaskExecResult_Success End Function |
#3
| |||
| |||
|
|
Hello javathehutt, I need to auto include yesterday's date into an emailed message TextBody. I've tried using getdate() but it didn't work. Is there someway to incorporate it into the function below? Help please? '************************************************* ******************** * ' Visual Basic ActiveX Script '************************************************* ******************** *** Function Main() 'References to Excel dim xl_app dim xl_Spreadsheet SET xl_app = CREATEOBJECT("Excel.Application") 'SET xl_app = GetObject("\\mongoReport.xls") SET xl_spreadsheet = xl_app.Workbooks.Open("mongoReport.xls") 'Run the macro xl_app.Run("transform_macro") xl_spreadsheet.Save xl_spreadsheet.Close xl_app.Quit set xl_app = Nothing sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = CreateObject("CDO.Configuration") With cdoConfig.Fields .Item(sch & "sendusing") = 2 ' cdoSendUsingPort .Item(sch & "smtpserver") = "qarelay1" .update End With Set cdoMessage = CreateObject("CDO.Message") With cdoMessage Set .Configuration = cdoConfig .From = "reporter (AT) acme (DOT) com" .To = "mongomadness (AT) acme (DOT) com" .Subject = "Automated Report For Today" .TextBody = "Your daily dose of Mongomadness Report.These reports are for files recieved on (NEED YESTERDAY'S DATE HERE). Please do not reply to this message, you will not get a response." .AddAttachment ( "\\mongoReport.xls") .Send End With Set cdoMessage = Nothing Set cdoConfig = Nothing Main = DTSTaskExecResult_Success End Function Dim yesterday 'As Date Dim yesterdaystr 'As String yesterday = DateAdd ("d" , -1 , Now() ) yesterdaystr = Year(yesterday) & "-" & Month(yesterday) & "-" & Day(yesterday) Bye |
![]() |
| Thread Tools | |
| Display Modes | |
| |