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,298 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 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Industry Leaders: 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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…
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…

717 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