avisoft20
Board Regular
- Joined
- Sep 10, 2016
- Messages
- 64
Dear All ,
I am using this code for outlook,but i want to email by gmail.
--
Sub Button1_Click()
email
End Sub
Public Function email()
Dim fnum As Integer
Dim lnum As Integer
lnum = 20
Dim tt1 As String
Dim tt2 As String
For fnum = 1 To lnum
tt1 = "b" & fnum
tt2 = "a" & fnum
tt3 = "c" & fnum
tt4 = "d" & fnum
tt5 = "e" & fnum
tt6 = "f" & fnum
esub = Range(tt4).Value
sendto = Range(tt1).Value
fname = Range(tt2).Value
fname1 = Range(tt5).Value
cc = Range(tt3).Value
bcc = Range(tt6).Value
Set app = CreateObject("Outlook.Application")
Set itm = app.createitem(0)
With itm
.Subject = esub
.to = sendto
.cc = cc
.attachments.Add (fname)
.attachments.Add (fname1)
.bcc = bcc
.display
.send
End With
Set app = Nothing
Set itm = Nothing
Next fnum
End Function
------------------
Thanks
Avinash Singh.
I am using this code for outlook,but i want to email by gmail.
--
Sub Button1_Click()
End Sub
Public Function email()
Dim fnum As Integer
Dim lnum As Integer
lnum = 20
Dim tt1 As String
Dim tt2 As String
For fnum = 1 To lnum
tt1 = "b" & fnum
tt2 = "a" & fnum
tt3 = "c" & fnum
tt4 = "d" & fnum
tt5 = "e" & fnum
tt6 = "f" & fnum
esub = Range(tt4).Value
sendto = Range(tt1).Value
fname = Range(tt2).Value
fname1 = Range(tt5).Value
cc = Range(tt3).Value
bcc = Range(tt6).Value
Set app = CreateObject("Outlook.Application")
Set itm = app.createitem(0)
With itm
.Subject = esub
.to = sendto
.cc = cc
.attachments.Add (fname)
.attachments.Add (fname1)
.bcc = bcc
.display
.send
End With
Set app = Nothing
Set itm = Nothing
Next fnum
End Function
------------------
Thanks
Avinash Singh.