Hi,
In a view i have Export to Excel button. The export is working fine. What i need is when i click on that button the excel sheet should get saved and should send a mail to me (It should not open that excel sheet on my desktop). Can anyone help me on this. Thanks in advance.
Subject: Mailing an Excel Sheet
You don’t say, but I’ll assume you’re using LS in the Notes client.
Create the export file. (this you have done - Excellent!)
Save it to disk (anywhere is fine and easy to do)
Create a mail message. (should be easy - look at NotesDocument if you need help)
Attach the file (look at NotesRichTextItem)
Send the email. (back to the NotesDocument)
Most of the code you need exists in Notes help.
Doug
Subject: Mailing an Excel Sheet
We’ve all posted code here before on how to create an Excel spreadsheet and open it on your desktop. You can find it if you search this forum and the Sandbox.
Any minute now someone will tell you to modifiy this code, running it on the server instead. I advise you against this because Microsoft Excel is not designed to work as a server application. Its not robust enough. You would need to buy an extra licence for Excel, install it on the server, and then write good multi-user code that doesn’t leave you with 100 instances of Excel all running on the server when your code crashes halfway through creating the spreadsheet. Its the quickest way to kill a server, and its hard for your operators to understand and fix in the middle of the night.
Instead, take the front end code, and simply don’t make Excel Visible on your user’s computer. After the spreadsheet has been generated, save it, and attach it to a new document in the source database. Then shut down the Excel COM object, still invisibly, and use the backend NotesDocument.Send to send an email doclink to yourself.