I have made it!
yes, i have made it!!!!
Though the code is not originally made by me but the modifiaction that I required, have been made by me and that too wihtput any theoretical macro knowledge. this has become possible because of the guidance by xld. it seems "THanks" would be a very small word but I think is the most appropriate. this would not been possible without your proper guidance
Though I not know you personally, but I think you are a good tutor also. the way you guiuded online, i think I would learn more from this forum.
Once agian , "THANKS".
Final code is given under:
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub SendEMail()
Dim Email As String, Subj As String
Dim Msg As String, URL As String
Dim r As Integer, x As Double
Dim iResponse As Integer
iResponse = MsgBox("Do you really want to send mails ?", vbYesNo + vbExclamation, "Email")
Select Case iResponse
Case vbYes
For r = 2 To 5 'data in rows 2-4
' Get the email address
Email = Cells(r, 2)
If Email <> "" Then
' Message subject
Subj = "testing Credit of salary"
' Compose the message
Msg = ""
Msg = Msg & "Dear " & Cells(r, 1) & "," & vbCrLf & vbCrLf
Msg = Msg & "It is hereby informed that salary for the month of " & Range("A10").Text & vbNewLine & _
"has been credited to your Bank a/c no. "
Msg = Msg & Cells(r, 3).Text & "." & vbCrLf & vbCrLf
Msg = Msg & "Mr. A" & vbCrLf
Msg = Msg & "Senior HR"
' Replace spaces with %20 (hex)
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")
' Replace carriage returns with %0D%0A (hex)
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg
' Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus
' Wait two seconds before sending keystrokes
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
End If
Next r
Case vbNo
' MsgBox Prompt:="You clicked No."
Exit Sub
End Select
End Sub