Import a excel worksheet

I am trying to import an excel file into the body of an automated mail, currently I am saving the excel file as a text file and importing line by line(see below), is their anyway of importing directly from excel?


Set doc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc, "Body" )
FileNum = Freefile()
FileName = "C:\latest Stock Prices.txt"
Open FileName For Input As FileNum
          Do While Not Eof(FileNum)
          Line Input #fileNum, oneLine
          Call rtitem.AppendText( oneLine )
          Call rtitem.AddNewLine( 1 )
          oneLine = "" 
     Close FileNum
     doc.Form = "Memo"
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

bjohns33Connect With a Mentor Commented:
Very simple example using COM (if you have any problems with this, you can revert to OLE, using Notes.NotesSession as the object):

Dim session As NotesSession
Set session = CreateObject("Lotus.NotesSession")
Call session.Initialize()

The subject 'Accessing the Domino Objects through COM' in the Domino Designer help, surprisingly :), gives a lot of reasonable examples to get you going, and a detailed discussion of the differences between the languages.

If you get stuck at all, let me know and I'll work through it with you.

You could try selecting everything in the Excel spreadsheet and then putting the cursor in the Body field of the Memo and hitting Paste, or Paste Special, if that is available. I am not sure if the formatting would get messed up though, but it's worth a try.


chawksAuthor Commented:
I am trying to automate this procees through an agent, pulling directly from a excel file, basically I am looking for the code which will automate impoting the file into a memo
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

You can do this through OLE, but you would need to have Excel installed on the server, which isn't elegant or recommended.

Is attaching the Excel file instead of importing the data an option?

If not, where and when is the Excel file created?  If it's created by a user with a Notes client on their machine (even if they haven't, there is a way to remotely invoke it from another machine with COM, but that get's messy!)then you could automate the process from within Excel with some fairly simple VBA.

Answers to the above and I'm sure we can come up with a solution!

chawksAuthor Commented:
Automating it from excel would be ideal, would you have any idea how to invoke it with VBA,

Not sure if this would work, but I use Simply Notes Import from for importing Excel data. Have not tried in an email though. Setup a profile & run with it, very easy.
  I agree with your decision. Points to bjohns33.
All Courses

From novice to tech pro — start learning today.