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,297 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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

738 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