Como cambiar esta macro para que envíe el archivo en pdf.
hoja = "OC"
correo = "xxxxxxxxxxxxx"
passwd = "xxxxxxxxx"
'
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Ruta = ThisWorkbook.Path & "\"
nombre = Sheets(hoja).Name
Sheets(hoja).Copy
ActiveWorkbook.SaveAs Filename:=Ruta & nombre & ".xlsx"
ActiveWorkbook.Close 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 = "xxxxxxxxxxx"
.From = "xxxxxxxxxxxxxxxx"
.Subject = "OC"
'.TextBody = "revisar neonico y estructuración"
.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