Notes View on the Web

This code will read a view and write selected fields out as a text file on the server then attach the file to a document while working from the Web. This allows users working from the Internet to download the attached text file and import it into a non-Lotus Notes product.

Sub Initialize
Dim Session As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim rtitem As Variant
Dim plainText(4) As Variant
Dim fileNum As Integer
Dim item As NotesItem
Dim doc As NotesDocument
Dim rtitem1 As NotesRichTextItem
Dim object As NotesEmbeddedObject

Set db = Session.CurrentDatabase
Set View = db.GetView("AttendeesXL")
Set doc = View.GetFirstDocument

'declare file for output
fileNum = Freefile
Open "C:\NotesData.TXT" For Output As fileNum

'Loop through the view
While Not(doc Is Nothing)
Set doc2 = View.GetNextDocument(doc)

Set item = doc.GetFirstItem("lname")
plainText(1) = item.Text
Set item = doc.GetFirstItem("name")
plainText(2) = item.Text
Set item = doc.GetFirstItem("rank")
plainText(3) = item.Text

Write #fileNum, plainText(1), plainText(2), plainText(3)
Set doc = doc2
Close #fileNum

'The following imports the text file and attach to a document
Set doc = New NotesDocument(db)
Set rtitem1 = New NotesRichTextItem(doc, "BodyAtt")
Set object = rtitem1.Embedobject(EMBED_ATTACHMENT, "" , "C:\NotesData.TXT")

doc.Form = "DataTrForm"
Call doc.Save(True, True)


End Sub

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.