Solved

outlook automation, foxpro set font on a variable in the body

Posted on 2014-11-11
9
340 Views
Last Modified: 2014-11-12
Looking to set the font type of  Courier New on a variable

      This.oOutlookEmailMessage.Body = pcBody
0
Comment
Question by:dc070994
  • 4
  • 3
  • 2
9 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 40437628
You have to use HTML message format. Look for the example here: http://msdn.microsoft.com/en-us/library/office/ff869979(v=office.15).aspx

olFormatHTML = 2

And the message in Courier New font could contain this HTML text:

<html>
<body>
<p style="font-family:'Courier New'">This is your text in Courier New font.</p>
</body>
</html>

More info: http://www.w3schools.com/tags/tag_font.asp
0
 

Author Comment

by:dc070994
ID: 40437841
oOutlook = CreateObject("cusOutlookAutomation")
oOutlook.show()
oOutlook.New
oOutlook.SetTo('&lc_address','&lc_address2')
oOutlook.SetSubject(psubject)
oOutlook.SetBody(pmessage)

IF !EMPTY(pattachment)
      oOutlook.AddAttachment(pattachment)
ENDIF

oOutlook.send
RELEASE oOutlook


Function SetBody(pcBody)

This.oOutlookEmailMessage.Body = pcBody

EndFunc

I need to know how to force the variable pcBody to appear In Courier New 9pt. in the messageobx,
0
 
LVL 2

Expert Comment

by:GEOFS
ID: 40437874
You could try entering or copying the body text to a textbox with the properties you want, then using that as the source of the Body property:

    Thisform.txtTextbox.Font = "Courier New"
    Thisform.txtTextbox.Value = "Hello world!"
    This.oOutlookEmailMessage.Body = Thisform.txtTextbox.Value
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 2

Expert Comment

by:GEOFS
ID: 40437882
Sorry, the first line of my sample code should refer to FontName instead of Font.
0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 40438087
Use following function:
Function SetBody(pcBody)

This.oOutlookEmailMessage.BodyFormat = 2
This.oOutlookEmailMessage.HTMLBody = [<html><body><p style="font-family:'Courier New'">] + pcBody + [</p></body></html>]

EndFunc

Open in new window

The FoxPro MessageBox cannot display Courier New font easily - it depends on Windows settings.
0
 
LVL 2

Expert Comment

by:GEOFS
ID: 40438167
Is there some problem with displaying Courier New in a textbox?
0
 
LVL 41

Expert Comment

by:pcelba
ID: 40438275
No, not at all but how is your question related to Outlook automation?

Your command:
 This.oOutlookEmailMessage.Body = Thisform.txtTextbox.Value

sets just the text value without any formatting. FoxPro does not know what everything you would like to do...
0
 
LVL 2

Expert Comment

by:GEOFS
ID: 40438438
I thought that perhaps some of the basic formatting might be carried from the textbox to the email along with the text.  I remembered seeing a similar suggestion somewhere and thought it might be worth a try.  Admittedly, it's in the realm of grasping at straws.
0
 

Author Closing Comment

by:dc070994
ID: 40438483
Thank you very much, this is exactly what i needed, Much appreciated
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

810 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