Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2004, 09:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default Bold Words in Strings

No, I'm not going to tell someone off. :D

I'm using the DoCmd.SendObject method to write an e-mail message to someone and was wondering if there's a way to bold one word out of a sentence. For example, this does not work, but it'll give you an idea of what I want.

strEmailMsg = "PSM No. " & Format(Me.txtPSMNo, "[Bold]") & " was assigned..."

So in the e-mail message, you'd see

PSM No. PSM-2004-0001 was assigned...

Is there a way? My e-mail client is Novell GroupWise.

Thanks!


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
 
Old September 8th, 2004, 02:41 PM
Authorized User
 
Join Date: Aug 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

SerranoG

I to have problems with the VBA code for bold. I came to the conclusion that words do not want to be bolded in VBA code. ;) J/K but I did find this page that discussed making a box and making the border darder. the code reads something like this
Private Sub Report_Page()
       On Error Resume Next
         ' Set Thickness and Border Style
         Me.DrawWidth = 6 ' larger number, thicker line
         Me.DrawStyle = 0 ' 0 to 6 = solid to invisible

         ' object.Line (x1, y1) - (x2,y2), color, [Box=B]
         Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbGreen, B
       End Sub

maybe the characters and formating in bold has something to do with the draw style or width. I don't know if this is helpful.

 
Old September 15th, 2004, 08:46 PM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If your email client allows for formatting as html then it is fairly easy to add colors, bold italic etc... I am only familiar with ms outlook but here is an example...

Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties.

    Dim olApp As Outlook.Application
    Dim objMail As Outlook.MailItem
    Set olApp = Outlook.Application
    'Create e-mail item
    Set objMail = olApp.CreateItem(olMailItem)

    With objMail
       'Set body format to HTML
       .BodyFormat = olFormatHTML
       .HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY><P>Enter the <B>message</B> text here. </P></BODY></HTML>"
       .Display
    End With
End Sub

message in the above example would be bold....
Hope this helps.

 
Old September 15th, 2004, 11:23 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

Greg,
I am not sure if this will work:

strEmailMsg = "PSM No. <B>" & Me.txtPSMNo & "</B> was assigned..."

or

strEmailMsg = "PSM No. &lt;B&gt;" & Me.txtPSMNo & "&lt;/B&gt; was assigned..."

John
 
Old September 21st, 2004, 10:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

John,

No go... both ways are taken literally.

Changing the e-mail type to HTML as FlatHead suggests would probably fix it, however, everyone's default e-mail view here is set to plain text. The only ones who would see it are those VERY few who set it otherwise. I'll just leave it as is...

Thanks for your suggestions.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old September 23rd, 2004, 05:20 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try this instead:

strEmailMsg = "PSM No. <B>'" & Me.txtPSMNo & "'</B> was assigned..."

or

strEmailMsg = "PSM No. <B>""" & Me.txtPSMNo & """</B> was assigned..."



John
 
Old September 24th, 2004, 06:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

No, that will only work if the user's mailbox is defaulted to accept mail in HTML format. Almost everyone here is set for plain text.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
a bold word in a selected sentence Birger XSLT 4 January 1st, 2007 07:02 PM
Pivot Subtotals in Bold paul20091968 Excel VBA 0 June 29th, 2006 07:03 AM
Bold fonts in JTextPane hary Java GUI 1 August 1st, 2005 06:22 PM
making a link bold knalle HTML Code Clinic 5 November 12th, 2004 11:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.