vba - Format specific text in Outlook -
i need format specific string value acquired excel in outlook.
once value provided excel, macro append value in email message.
i tried testing , setting value bold of contents of message became bold. how format value in such way can use font type, size , color liking?
obj.htmlbody = "<b>" & stragnt & vbcrlf & obj.htmlbody
option explicit sub createhtmlmail() 'creates new e-mail item , modifies properties. dim olapp outlook.application dim objmail outlook.mailitem set olapp = outlook.application 'create e-mail item set objmail = olapp.createitem(olmailitem) dim stragnt string stragnt = "<html><h2>the body html.</h2><body>type message text here. </body></html>" & vbcrlf & vbcrlf & _ "<p><font face=""comic sans ms"" size=""6"" color=""red""><b>test.</b></fontt></p>" & vbcrlf & vbcrlf & _ "<p><font face=""times new roman"" size=""4"" color=""blue""><i>test</i></font></p>" & vbcrlf & vbcrlf & _ "<p><font face=""arial"" size=""3"" color=""green"">test</font></p>" & vbcrlf & vbcrlf objmail 'set body format html .bodyformat = olformathtml .htmlbody = stragnt .display end end sub
msdn htmlbody property
Comments
Post a Comment