This forum is about Office integration. This site has a subforum just for Excel VBA. http://www.vbaexpress.com/forum/foru...?17-Excel-Help
In any case, CDO might be your answer for yahoo. Obviously, you need to change the inputs sent to the called Sub. I used early binding so you would need to set the CDO library reference as I commented.
' Add CDO reference for early binding method
' Tools > References > Microsoft CDO for Windows 2000 Library
' c:\windows\system32\cdosys.dll
' Log into Yahoo, Account Security, Set an APP password, use it below.
Sub Test_eYahoo()
eYahoo "YahooKen", "AppPasswordHere", "YahooKen@yahoo.com", "ken@gmail.com", "Subject", "Body", "D:\t\f.txt"
End Sub
Sub eYahoo(sUsr As String, sPass As String, sendFrom As String, _
sTo As String, sSubject As String, _
sBody As String, _
Optional sAttachment As String = "")
Dim cdomsg As New CDO.Message 'early binding method
'set cdomsg=new CDO.Message 'early binding only
'Dim cdomsg As Object 'late binding method
Set cdomsg = CreateObject("CDO.message") 'late binding method or early binding
cdomsg.Configuration.Load -1
With cdomsg.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Enter the username and password of your email account below
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sUsr
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sPass
'Edit the SMTP server below e.g. smtp.gmail.com or smtp.mail.yahoo.co.uk
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 '25, 465, 587
cdomsg.Configuration.Fields.Update
End With
' build email parts
With cdomsg
.To = sTo
.From = sendFrom
.subject = sSubject
.textBody = sBody
'.BCC
'.CC
'.ReplyTo = sendFrom
'.HTMLBody
'.HTMLBodyPart
If Dir(sAttachment) <> "" Then .AddAttachment (sAttachment)
.Send
End With
Set cdomsg = Nothing
End Sub