Go Back   Access World Forums > Apps and Windows > Excel

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 03-29-2019, 06:47 AM   #1
DanielR
Newly Registered User
 
Join Date: Mar 2018
Posts: 72
Thanks: 19
Thanked 0 Times in 0 Posts
DanielR is on a distinguished road
Bolding and Highlighting a String

Using VBA in excel I want to place a string in an email:

With newEmail
.Body = "Approval Instruction are as follows:"
End With

I want 'Approval Instruction' to be highlighted and made bold.
How do I do this?

DanielR is offline   Reply With Quote
Old 03-29-2019, 06:57 AM   #2
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,961
Thanks: 415
Thanked 712 Times in 691 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Bolding and Highlighting a String

Use .HTMLBody and string below?

Code:
"<b>Approval Instructions</b>" & " are as follows:"
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
Old 03-29-2019, 07:00 AM   #3
DanielR
Newly Registered User
 
Join Date: Mar 2018
Posts: 72
Thanks: 19
Thanked 0 Times in 0 Posts
DanielR is on a distinguished road
Re: Bolding and Highlighting a String

This does not work

DanielR is offline   Reply With Quote
Old 03-29-2019, 07:02 AM   #4
DanielR
Newly Registered User
 
Join Date: Mar 2018
Posts: 72
Thanks: 19
Thanked 0 Times in 0 Posts
DanielR is on a distinguished road
Re: Bolding and Highlighting a String

Sorry, It does work.
How do I specify a line break?
How do I highlight something?
DanielR is offline   Reply With Quote
Old 03-29-2019, 07:31 AM   #5
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,961
Thanks: 415
Thanked 712 Times in 691 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Bolding and Highlighting a String

Look up HTML codes

https://www.w3schools.com/html/html_formatting.asp
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
Old 03-29-2019, 07:38 AM   #6
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,961
Thanks: 415
Thanked 712 Times in 691 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Bolding and Highlighting a String

Here is something I use in one of my emails.

HTH
Code:
 ' Set up HTML tags
    strPad = "<tr><td>"
    strEndPad = "</td></tr>"
    strPadCol = "</td><td>"
    strBlankLine = "<tr></tr>"


            With objOutlookMsg
                .HTMLBody = .HTMLBody & strPad & str3rdPartyType & strPadCol & str3rdParty & strEndPad
                .HTMLBody = .HTMLBody & strPad & strDatetype & strPadCol & strDate & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Method:" & strPadCol & strMethod & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Reference:" & strPadCol & strRef & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Amount:" & strPadCol & strAmount & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Balance:" & strPadCol & strBalance & strEndPad
                ' Add any notes if they exist
                If Len(strNotes) > 0 Then
                    .HTMLBody = .HTMLBody & strPad & "Notes:" & strPadCol & strNotes & strEndPad
                End If
'                ' Add blank lines for next set
                .HTMLBody = .HTMLBody & strBlankLine & strBlankLine 
            End With
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
Old 03-29-2019, 07:45 AM   #7
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 10,055
Thanks: 110
Thanked 2,727 Times in 2,490 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Bolding and Highlighting a String

Also have a look at the attached example which includes highlighting and other HTML tags
Attached Files
File Type: zip RichTextExample.zip (31.0 KB, 12 views)


__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bolding the data in the Field Glen17 Reports 2 08-04-2016 10:04 PM
Bolding control name dgmorr Modules & VBA 3 02-15-2007 12:46 PM
Bolding Font in Report alastair69 Reports 2 01-11-2006 12:15 PM
Bolding labels on a report JC10001 Reports 7 11-17-2004 07:03 AM
Bolding records that have changed vvhrcon Reports 3 11-21-2003 08:15 AM




All times are GMT -8. The time now is 12:03 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World