Does any one have a script that refreshes a document and sends an email using outlook express saying whether it was successful or not ?
Allan Timarky
914-641-4193
Listserv Archives (BOB member since 2002-06-25)
Does any one have a script that refreshes a document and sends an email using outlook express saying whether it was successful or not ?
Allan Timarky
914-641-4193
Listserv Archives (BOB member since 2002-06-25)
I wrote this script for version 4.x and it refreshes a report that queries the repository to bring back the details on what happened. It is not exactly what you need, but very close. Simon
Declare Sub Launch(strDirectory as String, strDistribTo as String) Declare Sub SendMail(strDistribTo As String, strSubject As String, strFile As String)
Sub Main()
Call Launch(“Report Launch Confirmation","simon.miller@diverseylever.com”) Dim OlkApp As Object
Dim NewMail As Object
Dim Attachments as Object
Dim Rep as BOReport
Dim RepName as String
Set MyDoc = ActiveDocument
Set Rep = ActiveDocument.Reports.Item(1) RepName = Rep.Name
End Sub
Sub Launch(strDirectory as String, strDistribTo as String)
Dim Subject as String
Dim MyDoc as BODocument
Dim str as String
Dim SavePath as String
Dim ReportPath as String
Dim Rep as BOReport
Dim RepName as String
Set MyDoc = ActiveDocument
Set Rep = ActiveDocument.Reports.Item(1) RepName = Rep.Name
Application.Documents.Item(1).Refresh
strFullDirectory = “\noassql02\Reports$\HTML_Reports\DLC_Corporate” + RepName + “” + RepName + “” + RepName + “.htm”
Subject = strDirectory + " Report"
Set MyDoc = ActiveDocument
str = “”
SavePath = “\noassql02\Reports$\HTML_Reports\DLC_Corporate” + RepName + “.htm”
Call MyDoc.ExportSheetsAsHtml(SavePath,str,1,1,1,1,1,1,1,0,0,3) Call SendMail(strDistribTo, Subject, strFullDirectory)
Dim OlkApp As Object
Dim NewMail As Object
Dim Attachments as Object
Set OlkApp = CreateObject(“Outlook.Application”) Set NewMail = OlkApp.CreateItem(olMailItem) With NewMail
.To = “simon.miller@diverseylever.com”
.Subject = “Flush”
.Send
End With
End Sub
Sub SendMail(strDistribTo As String, strSubject As String, strFile As String)
Dim OlkApp As Object
Dim NewMail As Object
Dim Attachments as Object
Set OlkApp = CreateObject(“Outlook.Application”) Set NewMail = OlkApp.CreateItem(olMailItem) Set Attachments = NewMail.Attachments
Attachments.Add strFile
With NewMail
.To = strDistribTo
.Subject = strSubject
.body = “” & Chr(13)
.Send
End With
End Sub
Listserv Archives (BOB member since 2002-06-25)