Link to home
Start Free TrialLog in
Avatar of Dian S
Dian S

asked on

Change fonts in access vba to send mail in lotus notes

Hi ,

I know only basic vba.
I would like to send mail in lotus notes via microsoft access vba.
I found this code in the IBM website as example codes to change the fonts.

I copy paste to my script but it stopt on  "Dim session As New NotesSession" and error message is user-defined type is not defined.
Could you please help?
Many thanks

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim doc As New NotesDocument(db)
  Call doc.AppendItemValue("From", session.UserName)
  Call doc.AppendItemValue("Subject",  _
  "Meeting time changed")
  Dim richStyle As NotesRichTextStyle
  Set richStyle = session.CreateRichTextStyle
  Dim richText As New NotesRichTextItem(doc, "Body")
  richStyle.NotesFont = FONT_HELV
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText("The meeting is at ")
  richStyle.NotesFont = FONT_COURIER
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText("3:00")
  richStyle.NotesFont = FONT_HELV
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText(" not 2:00")
  Call doc.Save(True, False)
End Sub
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

If this question is in any way related to your other question, then I'd suggest to use CSS styles. A lot easier to do.
Based on the post here i think you need to change the code like this...i am afraid i don't have Lotus Notes to check
Dim session as Object
Dim db As Object
Dim doc As Object
Set session = CreateObject("Notes.NotesSession")
Set db =session.CurrentDatabase
Set doc= db .CREATEDOCUMENT

Open in new window

Avatar of Dian S
Dian S

ASKER

Hi John,  Many thanks for your suggestion, but it still does not work.
Too bad...as i said i don't have Lotus Notes...where do you get the problem ?
The language of the code you have is LotusScript. It closely resembles Visual Basic, but it is not the same.

What exactly would you like to change? You should know that there are only 3 pre-defined fonts in Notes, so if you want to use yet a 4th one you're out of luck. That is, unless you want to use MIME, as I suggested in your other question...

Just an example of how to write VBA code that works on Notes (it doesn't solve your fonts problem): https://www.mrexcel.com/forum/excel-questions/518746-send-range-rich-text-body-through-lotus-notes.html
ASKER CERTIFIED SOLUTION
Avatar of Dian S
Dian S

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial