Manikandan G
New Member
I created a vba for sending an automatic email from excel. if i run vba it will ask the particular row which i want to send. but i have one help for blod the purticular cell in that row.. the rows will display in msg. i want to bold cells(I,6).value that want to reflect in body of the mail
Code:
Global rownum As Integer
Sub previewmails()
SENDEMAIL.Show
I = rownum
chk = Sheet1.Cells(I, 1)
If chk = "" Then
MsgBox "value is empty in the field: " & I
End
End If
chk = Sheet1.Cells(I, 15)
If chk = "YES" Then
MsgBox "Already completed: " & I
End
End If
MyFile = Cells(I, 15).Value
Subj = Cells(I, 3).Value
EmailTo = Cells(I, 14).Value
CCto = ""
'User = Cells(I, 11).Value
msg = Cells(I, 4).Value & " " & Cells(I, 5).Value & " " & Cells(I, 6).Value & " " & Cells(I, 7).Value & " " & Cells(I, 8).Value & " " & Cells(I, 9).Value & " " & Cells(I, 10).Value & " " & Cells(I, 11).Value & " " & Cells(I, 12).Value & " " & Cells(I, 13).Value & " " & Cells(I, 14).Value
'"Dear " & User & vbNewLine & " Please find attached your audit trail" & " Kind regards " & vbNewLine & vbNewLine & Application.UserName
'Workbooks.Open Filename:="C:\Documents and Settings\Administrator\Desktop\" & MyFile, UpdateLinks:=False
Application.DisplayAlerts = False
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = EmailTo
.CC = CCto
.BCC = ""
.Subject = Subj '
.body = msg
'.Attachments.Add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.DisplayAlerts = False
Application.DisplayAlerts = True
Sheet1.Cells(I, 15) = "YES"
End Sub