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
Dian SAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
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.
John TsioumprisSoftware & Systems EngineerCommented:
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

Open in new window

Dian SAuthor Commented:
Hi John,  Many thanks for your suggestion, but it still does not work.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

John TsioumprisSoftware & Systems EngineerCommented:
Too i said i don't have Lotus Notes...where do you get the problem ?
Sjef BosmanGroupware ConsultantCommented:
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):
Dian SAuthor Commented:
Dim objMailStyle As Object
Dim objMailSession As Object

Set objMailStyle = objMailSession.CREATERICHTEXTSTYLE
        objMailStyle.NOTESFONT = 1
        objMailStyle.Bold = True
        objMailStyle.FontSize = 10
        objMailStyle.NotesColor = 14
        objMailRT.APPENDSTYLE objMailStyle

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.