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,293 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
ID: 33529040
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 11

Accepted Solution

by:
larsberntrop earned 500 total points
ID: 33530614
You need to use a GetNotesFont call:

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

Expert Comment

by:Bill-Hanson
ID: 33530766
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 33530776
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
 
LVL 22

Expert Comment

by:mbonaci
ID: 33539850
hmm, ok, scratch scratch
0
 
LVL 11

Expert Comment

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

Expert Comment

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

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

Expert Comment

by:larsberntrop
ID: 33540185
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 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