Hi allI am trying to create an excel report and sending it to through mail.
How can i attach it to mail.
i tried following code,but it is not working
can you tell where i am wrong?
' REM temporary location to save the Excel file
OutputFile = "d:\scripts\excel\file1.xls"
'Excel Creation
Dim Excel As Variant
Dim xlWorkbook As Variant
Dim xlSheet As Variant
Set Excel = CreateObject( "Excel.Application" )
Excel.Visible = False
Excel.Workbooks.Add
Set xlWorkbook = Excel.ActiveWorkbook
Set xlsheet = Excel.Workbooks(1).Worksheets(1)
Excel.Windows(1).DisplayGridlines=True
Excel.ScreenUpdating = False
Excel.Calculation = -4135
row=1
With xlsheet
.Cells(row, 1).Value = "Your action/request"
.Cells(row, 2).Value = "See below!"
.Cells(row, 3).Value = "Your comment"
.Cells(row, 4).Value = "Document Holder"
.Cells(row, 5).Value = "DocNo"
.Cells(row, 6).Value = "DocTitle"
.Cells(row, 7).Value = "CustomerStatus"
.Cells(row, 8).Value = "Open since"
.Cells(row, 9).Value = "Last update"
.Cells(row, 10).Value = "Status"
.Cells(row, 11).Value = "Company"
.Cells(row, 12).Value = "BPFuture"
.Cells(row, 13).Value = "ProductCodeNo"
.Cells(row, 14).Value = "ProductDescription"
.Cells(row, 15).Value = "BusinessAreaNo"
.Cells(row, 16).Value = "ProductCentreNo"
End With
For i=1 To Ubound(DocHolder)
With xlsheet
.Cells(row+i, 4).Value = DocHolder(i)
.Cells(row+i, 5).Value = DocNo(i)
.Cells(row+i, 6).Value = DocTitle(i)
End With
Next
Call Excel.Save(OutputFile)
Excel.Application.Quit
Set Excel = Nothing
'So now excel is ready
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem(doc, "Body" )
Set object = rtitem.EmbedObject (1454, "","OutputFile","Quarterly Report" )
Call doc.Send(0,"mailID")
End Sub