realiza el procedimiento como si ya estubiera corriendo bn pero no me aparese el correo en inbox ni nada..
esta macro la mando llamar desde un boton en un formulario de Visual
Const EMBED_ATTACHMENT As Long = 1454
Const stPath As String = "C:\Ensamble"
Const stSubject As String = "solicitud"
Const vaMsg As Variant = "Solisitud de credenciales." & vbCrLf & _
"Saludos Cordiales,"
Const vaCopyTo As Variant = "jose.salazargarcia@gm.com"
-------------------------------------------------------------------------
Private Sub CommandButton1_Click()
Dim stFileName As String
Dim vaRecipients As Variant
Dim lista(40) As Variant
Dim noSession As Object
Dim noDatabase As Object
Dim noDocument As Object
Dim noEmbedObject As Object
Dim noAttachment As Object
Dim stAttachment As String
stFileName = Format(Now, "yyyy-mm-dd h-mm-ss")
stAttachment = stFileName & ".xls"
With ActiveWorkbook
.SaveAs stAttachment
.Close
End With
Application.Workbooks("Prueba credenciales2.xlsm").Activate
Sheets("CORREO").Select
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
Set noDocument = noDatabase.CreateDocument
Set noAttachment = noDocument.CreateRichTextItem("stAttachment")
Set noEmbedObject = noAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
With noDocument
.Form = "Memo"
.sendto = lista
.CopyTo = vaCopyTo
.Subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
.PostedDate = Now()
.Send 0, vaRecipients
End With
Kill stAttachment
Set noEmbedObject = Nothing
Set noAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
MsgBox "Este e-mail ha sido enviado exitosamente", vbInformation
End Sub
¿qué es vaRecipients?
Prueba a recorrer paso a paso con [F8] a ver dónde falla.
------
Ya sé Excel, pero necesito más.