?
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
Medium Priority
?
1,302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
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!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

765 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