在VBA中改变文本颜色
我需要将“Cells(cell.Row,“A”).Value”单元格(cell.Row,“E”).Value”的颜色更改为蓝色 你能帮忙吗在VBA中改变文本颜色,vba,excel,outlook,Vba,Excel,Outlook,我需要将“Cells(cell.Row,“A”).Value”单元格(cell.Row,“E”).Value”的颜色更改为蓝色 你能帮忙吗 Sub Test1() Dim OutApp As Object Dim OutMail As Object Dim cell As Range Dim Test As String Application.ScreenUpdating = False Set OutApp = CreateObject
Sub Test1()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim Test As String
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 = "TITLE" & " - " & Format(Now, "dd_mmmm_yyyy")
.Body = Test & "Dear " & Cells(cell.Row, "A").Value _
& vbNewLine & vbNewLine & _
"Text1" & _
vbNewLine & vbNewLine & _
"Text2'" & Cells(cell.Row, "E").Value & "TEXT" & _
vbNewLine & vbNewLine & _
"TEXT3" & _
vbNewLine & vbNewLine & _
"TEXT4" & _
vbNewLine & vbNewLine & _
"TEXT5" & _
vbNewLine & vbNewLine & "Many thanks," & vbNewLine & vbNewLine & "DCX PMO Team"
'Adding an attachment
.Attachments.Add ("D:\Users\ABOHANNO\Desktop\Digital Transformation\tagging\DCX Sales Process.pptx")
.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
试试这个:
cell.Resize(1,5).Font.Color = vbBlue
在cells.interior.ColorIndex上搜索你能给我看一下要在正确位置使用的代码吗?不,对不起,它不起作用-你有什么其他建议吗?从你的代码中删除错误恢复时的
,
-你不能在适当位置进行故障排除。