Te anexo la variante
Sub EnviarHoja()
'Por.Dante Amor
correo = "[email protected]" 'correo de gmail
passwd = "pwd" 'pass de gmail
hoja = "Hoja1" 'Nombre de la hoja
'
Set h2 = Sheets(hoja)
ruta = ThisWorkbook.Path & "\"
nombre = h2.Name
'
h2.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=ruta & nombre & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
'
Dim Email As CDO.Message
'
Set Email = New CDO.Message
Email.Configuration.Fields(cdoSMTPServer) = "smtp.gmail.com"
Email.Configuration.Fields(cdoSendUsingMethod) = 2
With Email.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CLng(465)
.Item("http://schemas.microsoft.com/cdo/" & "configuration/smtpauthenticate") = Abs(1)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = correo
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = passwd
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
End With
With Email
.To = "[email protected]"
.From = correo
.Subject = "Planilla Electrónica"
'.TextBody = "Cuerpo del coreo"
.AddAttachment ruta & nombre & ".xlsx"
.Configuration.Fields.Update
On Error Resume Next
.Send
End With
If Err.Number = 0 Then
MsgBox "El mail se envió con éxito"
Else
MsgBox "Se produjo el siguiente error: " & Err.Number & " " & Err.Description
End If
Set Email = Nothing
End Sub