-
Feb 18th, 2014, 02:16 PM
#1
Thread Starter
New Member
Text Bold in VB
Hi All,
I have to make the bold letters in the below mentioned code. Here the word " Invitation " should be bold and made as blue color. How can I do it?
Sub Test1()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2013
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = cell.Value
.Subject = "Invitation"
.Body = "Hello, " & vbNewLine & vbNewLine & _
"Invitation " & vbNewLine & vbNewLine & _
"Warm Regards," & vbNewLine & _
"Annie Antone"
'You can add files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'Or use Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
-
Feb 18th, 2014, 07:27 PM
#2
Re: Text Bold in VB
Looks like code to send an email. I believe most email clients can render HTML so try bolding tags:-
Code:
Subject = "<b>Invitation</b>"
I'm just taking a stab in the dark here. I've never done anything with email as a developer so I don't really know.
-
Feb 18th, 2014, 07:37 PM
#3
Thread Starter
New Member
Re: Text Bold in VB
No it is not coming in bold.
-
Feb 18th, 2014, 07:44 PM
#4
Re: Text Bold in VB
I might be wrong but I think bold subject text depends on email client and not the sender.
-
Feb 18th, 2014, 07:53 PM
#5
Re: Text Bold in VB
It depends on both the sender and receiving client... the sender has to make sure the text is marked up properly by either sending the correct HTML or RTF. It then also depends on the receiving client being able to render the HTML/RTF that was sent.
In this case, setting the .Body only sets the basic plain text part of the message. In order to send the HTML, you'll want to set the HTMLBody property (Ithink that's the right one) and set the .IsHTML (again, I think that's right) to True, so it knows there's two parts and can be rendered in the client, if it supports it.
-tg
-
Feb 18th, 2014, 07:54 PM
#6
Re: Text Bold in VB
Oh... wait... are we talking about the subject line? or the Body of the message? I assumed we were talking about the message... I don't think ANY client supports HTML or any markup in the Subject line... at least I haven't seen one that did.
-tg
-
Feb 19th, 2014, 01:24 PM
#7
Re: Text Bold in VB
Originally Posted by techgnome
Oh... wait... are we talking about the subject line? or the Body of the message? I assumed we were talking about the message... I don't think ANY client supports HTML or any markup in the Subject line... at least I haven't seen one that did.
-tg
Yep, the subject line. The only client I have seen that do this kind of formatting is browser based.
-
Feb 19th, 2014, 01:27 PM
#8
Re: Text Bold in VB
In any case this isn't a VB6 question but an Office Automation question.
The issues are the same whether you use VB6, VBA, VBScript, Visual FoxPro, Visual Fred, or just about anything else supporting COM Automation.
Wrong forum.
-
Feb 19th, 2014, 03:36 PM
#9
Re: Text Bold in VB
I guess I was asking how did we get to the conclusion it was the subject line? I see "Invitation" twice in the code... once in the subject line, and one in the body, which is where I apparently gravitated towards. I didn't even see the subject line initially... but that might be because usually when these requests come in, it's about the body.
-tg
-
Feb 19th, 2014, 05:01 PM
#10
Re: Text Bold in VB
Originally Posted by techgnome
I guess I was asking how did we get to the conclusion it was the subject line?
I guess this could be the answer, TG.
Originally Posted by sathishkm
Hi All,
... Here the word " Invitation " should be bold and made as blue color. How can I do it?
...
With OutMail
.to = cell.Value
.Subject = "Invitation"
.Body = "Hello, " & vbNewLine & vbNewLine & _
-
Feb 19th, 2014, 06:50 PM
#11
Re: Text Bold in VB
Yeah, I see that NOW...
but it's also in the Body:
Code:
.Body = "Hello, " & vbNewLine & vbNewLine & _
"Invitation " & vbNewLine & vbNewLine & _
Guess we'll never know since it appears that the OP has pulled a disappearing act on us.
-tg
-
Feb 19th, 2014, 07:14 PM
#12
Re: Text Bold in VB
I think he went to study up on Visual Fred.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|