Saltar al contenido

Cómo adjuntar un archivo usando Thurderbird o Outlook


Recommended Posts

Ciao a
tutti e il mio problema è questo: con un foglio excel e la sua
vba vorrei inviare e-mail con
allegati pdf o altri formati che si trovano nella mia sottocartella chiamata (Utility) ma per esigenze personali uso sia (Outlook) che (Thurderbird) Ma anche se provo un mare di soluzioni, mi fa sempre dare un errore e non carico nulla si dà un'occhiata e mi dicono perché?
Grazie saluti da A.Maurizio

Prova_Email_Con_Allegato_3.rar

Enlace a comentario
Compartir con otras webs

@A.Maurizio, para enviar por Outlook yo uso esta macro adaptada a mi necesidad. Espero te sea de ayuda.

Sub EnviarPDF()
'
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.session.logon

Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
       
With OutMail
 .To = "destinatario@hotmail.com" 'añadimos el destinatario
 .CC = "destinatario@hotmail.com" 'añadimos el correo de copia
 .BCC = ""
 .Subject = "Asunto" 'añadimos el asunto del correo
 .body = "Cuerpo del correo" 'añadimos el cuerpo y el pié.
 .Attachments.Add "C:\Users\xxxxxx\xxxxxx\archivo.pdf"  'añadimos la dirección del archivo PDF
 .send
End With

Set OutMail = Nothing: Set OutApp = Nothing
MsgBox "PROCESO FINALIZADO", vbInformation
'
End Sub

Te dejo un archivo de ejemplo.

Saludos.

Moisés.

Enviar PDF por Outlook.xlsm

Enlace a comentario
Compartir con otras webs

Hello Pirtrafilla
Thank you so much for your help
But according to you
Where can I find concrete help on the web to help me attach a document using Thurderbird
Because actually:
Has the strength to make attempts I managed to open this application.
And it works fine too
But if I try to insert the concept of (Attachments.Add)
In this case, problems arise in the nature of sharing written data.
Therefore the program crashes and I don't understand why.
This is the part that works perfectly and Opens the application that is not (Outlook):
 

Option Explicit
Dim sdest
Dim ssubject
Dim sbody
Dim sCC
Dim sBCC

Dim RetVal As Long
Dim sCommand As String

Const SW_SHOWNORMAL As Long = &H1

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Declare Function ConnecttoprinterDig Lib "winspool.drv" (ByVal hWnd As Long, ByVal flags As Long) As Long

Private Declare Function Play Lib "WINMM.DLL" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

'Apre il Programma di Posta Elettronica Predefinita
Public Function OpenEmailProgram(ByVal EmailAndress As String) As Boolean
On Error Resume Next
Dim Res As Long
Res = ShellExecute(0&, "open", "Mailto: " & EmailAndress, vbNullString, _
vbNullString, vbNormalFocus)
OpenEmailProgram = (Res > 32)
End Function

If Not OpenEmailProgram(Sheets("Invio Email").Range("J1")) Then
MsgBox "Impossibile Eseguire il Programma di Posta Elettronica"
End If

Sub Invio_Email_thunderbird()


    Dim strCommand As String, strSubject As String, strBody As String
   
    Dim strFilePath As String

    
    strSubject = "Subject"
    strFilePath = ThisWorkbook.Path & "\Utility\1.pdf.pdf"
    strBody = "Corpo Del Messaggio 2"
    
    'use only one of the following thunderbird path, depending on your operating system:
   ' strCommand = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird"
   ' strCommand = "C:\Program Files (x64)\Mozilla Thunderbird\thunderbird"
    strCommand = "C:\Program Files\Mozilla Thunderbird\thunderbird"
    
    
    strCommand = strCommand & " -compose " & "to=" & Cells(1, "J") & "," & "cc=" & "," & _
    "subject=" & "Attenzione" & "," & "body=" & strBody & ", " & "attachments=" & strFilePath

    Call Shell(strCommand, vbNormalFocus)

End Sub

Now I repeat: The application that is not (Outlook) is opened
The Problem is that I do not accept The Procedure of (.Attachments.Add "C: \ Users \ xxxxxx \ xxxxxx \ archivo.pdf") As written by you in your Help.
That's all
But it does not matter ; Sooner or later I will be able to solve this problem too
Greetings and Thanks

Enlace a comentario
Compartir con otras webs

Hi Pirtrafilla and thanks for your link, I will definitely keep it with care for the next things.
But in the meantime I managed to solve everything by myself and now it works fine.
Now for me another Problem arises which is to Create Alternative Attachments; How could they be Word / Excell / Pdf
But that I only know how to take into consideration the body of the message, including the Embedded Image; And not all of the Excel Sheet Including the Shapes.
That's all; But this is a whole other story.
Thanks anyway for your support and interest. Greetings from A.Maurizio

Enlace a comentario
Compartir con otras webs

Hola @A.Maurizio. Prueba y si no lo consigues no dudes en preguntar, por aquí hay muchos maestros que nos ayudan mucho. Si está en mi mano hacerlo también, aunque yo soy mas novato.

También en internet hay bastante información sobre añadir archivos o similar, por Outlook, Hotmail, Gmail...

Moisés.

 

 

Enlace a comentario
Compartir con otras webs

Hola Pirtrafilla Gracias por el Concejo lo haré de inmediato, no solo porque sé que este foro está todo preparado y gente amigable; Pero también porque llevo un tiempo intentándolo sin conseguir nada.
Gracias infinito
Hola y que tengas un buen fin de semana

##########################################################

Hello Pirtrafilla Thanks for the Council I will do it immediately, not only because I know that this forum is all prepared and friendly people; But also because I've been trying for a while without getting anything
Thanks Infinite
Hello and have a good weekend

Enlace a comentario
Compartir con otras webs

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

  • 96 ¿Te parecen útiles los tips de las funciones? (ver tema completo)

    1. 1. ¿Te parecen útiles los tips de las funciones?


      • No
      • Ni me he fijado en ellos

  • Ayúdanos a mejorar la comunidad

    • Donaciones recibidas este mes: 0.00 EUR
      Objetivo: 130.00 EUR
  • Archivos

  • Estadísticas de descargas

    • Archivos
      177
    • Comentarios
      90
    • Revisiones
      27

  • Crear macros Excel

  • Mensajes

    • Hola, Mejor que subas un archivo que contenga esas fórmulas, indicando qué resultados esperas conseguir. Así ayudas a quien quiera ayudarte; no le obligas a que reproduzca ese modelo, y de paso podrá ver cuál es el objetivo buscado con esa/s fórmula/s. Saludos,
    • Buenas noches quisiera hacer esta formula auto incremental    =SI(INDIRECTO("'Casos de Prueba'!I1")="Resultados Ciclo 1"; SI(CONTAR.SI(INDIRECTO("'Casos de Prueba'!I:I"); "OK")=0; 0; CONTAR.SI(INDIRECTO("'Casos de Prueba'!I:I"); "OK")); 0)      para que cada vez que copiase y pegase la celda con la formula  se incrementara la letra en este caso la I pasara a J ,como el numero perteneciente a Resultados Ciclo pasando en este caso del 1 al 2.   Tengo también esta formula =CONCATENAR("CP";TEXTO(MAX((SI((ESNUMERO(HALLAR("CP";A$1:A1)))*(A$1:A1<>"");VALOR(EXTRAE(A$1:A1;3;3));0))+1);"000")&" - "&B2) quisiera que no tuviera los 3 ceros si no que fuera por ejemplo CP1 y se fuera incrementando. Gracias un saludo.
    • Con el diseño así como lo tiene en su libro, una fórmula de BUSCARV con COINCIDIR debería ser de utilidad =C5*BUSCARV($C$1,Tabla1[#Todo],COINCIDIR($D5,Tabla1[#Encabezados],0)) Es con lo que participaría en su consulta. Lo que resta es definir que hacer si no encuentra la OT porque así como esta le devolvería error en ese caso, o si tiene condiciones que haya podido omitir también le afectarían el resultado.
    • He cambiado mi macro a este: Sub repetir() Set a = Sheets(ActiveSheet.Name) uf = a.Range("C" & Rows.Count).End(xlUp).Row 'ultima fila con datos ActiveCell.Select ActiveCell.Offset(1, 0).Select   'Application.OnTime Now + TimeValue("00:00:10"), "repetir", , True End If End Sub   Lo que no se es como detenerlo al llegar a la ultima fila con datos de la columna C. Muchas gracias
    • Buenas tardes a todos. Tengo un problema que preciso de vuestra ayuda.  Tengo que controlar los gastos de la oficina que trabajo y he de repartir unos gastos a % según una OT y unos tipos de gastos. Envío un archivo adjunto. Lo que necesito es que lo que aparece en la columna en amarillo lo haga automáticamente, teniendo en cuenta los datos de la tabla a la derecha. Por ejemplo, el primer gasto tiene una cuota de 1477 euros y teniendo en cuenta que es un gasto de tipo Común y que la OT es la 12810234, le corresponde un gasto de 605,57 euros ya que según la tabla de la derecha su % a imputar es de un 41%. ¿alguien me puede ayudar con la formula? He de añadir muchas más líneas y más hojas con el resto de OT y en el futuro cambiar más datos, así que necesito automatizarlo con una formula Excel. Gracias. Control de gastos.xlsx
  • Visualizado recientemente

    • No hay usuarios registrado para ver esta página.
×
×
  • Crear nuevo...

Información importante

Echa un vistazo a nuestra política de cookies para ayudarte a tener una mejor experiencia de navegación. Puedes ajustar aquí la configuración. Pulsa el botón Aceptar, si estás de acuerdo.