Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending mail with rich text

Status
Not open for further replies.

weeze2

Technical User
Jun 18, 2002
129
DK
Hi. I am not sure if this is more Visual Basic or more Notes. I have a function in VBA (Word) that sends a mail usin Lotus Notes. My problem is that I need to format the text in the mail to be able to get bold text or different fonts for example.
The function I am using at the moment passes a simpel string to the body of the mail document and I it is therefore not possible to variations of textin the e-mail body.

I have seen that it is possible to maybe pass rich text(object) to the body part. So that one can format the text in VBA before inserting in the mail.
Does anyone know of where I can get help or more info on this?
 
This works in Office/97

Add into your project references the following file:
c:\lotus\notes\domobj.tlb
(where c:\lotus\notes is your lotus notes program directory)

Option Explicit

Private Sub CommandButton1_Click()

Dim body As NotesRichTextItem
Dim dataDir As NotesDbDirectory
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim style As NotesRichTextStyle

Dim session As New NotesSession
Call session.Initialize("") 'Prompt for password for current id

Set dataDir = session.GetDbDirectory("")
Set db = dataDir.OpenMailDatabase
Set doc = db.CreateDocument()
Set body = doc.CreateRichTextItem("Body")

Set style = session.CreateRichTextStyle
style.FontSize = 24 'Point size
style.NotesColor = 2 'COLOR_RED
style.NotesFont = 0 'FONT_ROMAN

Call doc.ReplaceItemValue("Form", "Memo")
Call doc.ReplaceItemValue("SendTo", "User Name/orgunit/org")
Call doc.ReplaceItemValue("Subject", "This doc mailed from MS Office 97")
Call body.AddNewLine(1)
Call body.AppendStyle(style)
Call body.AppendText("Hallo Peter")
Call doc.Send(False)

End Sub

Find me @ onlinecorporatesoftware.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top