Question:
How to keep Cell Formatting When Sending Email with VBA from Excel?
keithaggie
2013-06-18 13:10:26 UTC
I am using a macro to take a what is entered in a cell and use it as the body of my email. However I need the email to retain some of the formatting such as text in bold or italics. Right now I am just having the macro select the value of the cell and use that as the body of the email. How would I modify the code to allow the formatting to stay the same in the email?
Four answers:
anonymous
2013-06-22 03:27:43 UTC
Code:

Function RangetoHTML(rng As Range)

' Changed by Ron de Bruin 28-Oct-2006

' Working in Office 2000-2010

Dim fso As Object

Dim ts As Object

Dim TempFile As String

Dim TempWB As Workbook



TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"



'Copy the range and create a new workbook to past the data in

rng.Copy

Set TempWB = Workbooks.Add(1)

With TempWB.Sheets(1)

.Cells(1).PasteSpecial Paste:=8

.Cells(1).PasteSpecial xlPasteValues, , False, False

.Cells(1).PasteSpecial xlPasteFormats, , False, False

.Cells(1).Select

Application.CutCopyMode = False

On Error Resume Next

.DrawingObjects.Visible = True

.DrawingObjects.Delete

On Error GoTo 0

End With
bonnenfant
2016-12-18 15:11:18 UTC
Vba Excel Cell Format
anonymous
2014-09-04 18:50:54 UTC
Don't listen to these guys, they clearly have no clue on what they're talking about. I am a developer at Microsoft so I know a thing or two about computers. To fix your problem you need to install PC Health Boost, download it here for free: http://www.getpchealthboost.com



It's very light and it's the only antivirus/cleaner with a 99.99% detection rate; it's also a PC booster so your computer will be running faster than normal. Install it, hit run and problem solved. It shouldn't take you more than 5 minutes.
matsumura
2016-12-29 18:14:24 UTC
If UCase(Left ( Cells.selection("E1").value , a million)) = "W" Then Cells.selection("A" & n, "J" & n).indoors.ColorIndex = 3 end If p.s.... i had to insert some random areas to get it to show appropriate onscreen


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...