Solved

Need VB code to send out a Lotus Notes e-mail in monospaced font, such as COURIER NEW, not COURIER

Posted on 2010-08-25
8
1,280 Views
Last Modified: 2013-12-18
How do I set "Courier New" as the font for richStyle.FontNotes?
richStyle.NotesFont=COURIER works but COURIER_NEW is not defined.
What I am looking for is a way to set a monospaced font when
composing a Lotus Notes email programmatically in VB.  It doesn't
have to be using RichStyle, just the end result is I need a piece
of VB code that sends out a Lotus Notes email in a monospaced
font like COURIER NEW.  Any help on this is greatly appreciated.

This almost works but cannot set a monospaced font:

Dim session As New NotesSession

  Dim db As NotesDatabase
  Dim doc As New NotesDocument(db)
  Dim richStyle As NotesRichTextStyle

  Dim richText As New NotesRichTextItem(doc, "Body")
 
  Set db = session.CurrentDatabase

  Call doc.AppendItemValue ("From", session.UserName)
  Call doc.AppendItemValue ("Subject", Inputbox("Subject?"))

  Set richStyle = session.CreateRichTextStyle
  richStyle.NotesFont = FONT_COURIER
  richStyle.FontSize = 14
 
  Call richText.AppendStyle(richStyle)
 
  newPara = Inputbox ("Paragraph of text for ""Body"" item")
 
  firstPara = True
 
  While newPara <> ""

    If firstPara Then
      firstPara = False
    Else
      Call richText.AddNewLine(2)
    End If

    Call richText.AppendText(newPara)

    newPara = Inputbox ("Paragraph of text for ""Body"" item")
 
Wend
 
End of problem description.
0
Comment
Question by:toddvoros
  • 3
  • 3
  • 2
8 Comments
 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
Isn't Courirer monospace font?

You can try to use GetNotesFont to get other OS registered fonts, like this:
richStyle.NotesFont = richText.GetNotesFont( "OSRegisteredFontName", addOnFail )

Open in new window

0
 
LVL 10

Accepted Solution

by:
larsberntrop earned 500 total points
Comment Utility
You need to use a GetNotesFont call:

richStyle.NotesFont = richText.GetNotesFont("Courier New", True)
0
 
LVL 22

Expert Comment

by:Bill-Hanson
Comment Utility
Yes, GetNotesFont will work, but so will defining the COURIER_NEW constant your self, or just use the constant value (4).

Const COURIER_NEW = 4
richStyle.NotesFont = COURIER_NEW

or

richStyle.NotesFont = 4
0
 
LVL 22

Expert Comment

by:Bill-Hanson
Comment Utility
That said, I rarely use richtext anymore since the MIME classes are now available.  Check out this example...

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/Lotus_SmartSuite/Lotus_Notes/Q_24468076.html#24575544
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
hmm, ok, scratch scratch
0
 
LVL 10

Expert Comment

by:larsberntrop
Comment Utility
@mbonaci: what question does "hmm, ok, scratch scratch" answer?
0
 
LVL 22

Expert Comment

by:mbonaci
Comment Utility
That should be obvious...
I provide the solution, you fill the params.

IMO, the question should have been split (at least).
0
 
LVL 10

Expert Comment

by:larsberntrop
Comment Utility
I did not see your solution until after I submitted mine, (had it open in the background and forgot to press submit)

But I see your point.  Although I have noticed that most askers prefer to get a very specific answer.  (Not that I provide those kind af answers all the time, quite often point to the Designer help or a website).

Cheers,
Lars
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now