Access - Automatización de Outllook

 
Vista:
sin imagen de perfil
Val: 21
Ha disminuido su posición en 37 puestos en Access (en relación al último mes)
Gráfica de Access

Automatización de Outllook

Publicado por Juan (21 intervenciones) el 09/10/2020 17:21:35
Hola a todos

Mi consulta es la siguiente:
Tengo automatizado en Access el envío de mail mediante Outlook.
Cuando le doy a enviar, me crea el mail, con el Asunto, una cabecera con un texto, añade un informe que previamente se ha exportado en formato HTML y la firma.
El tema es cuando el informe que genera Access tiene dos páginas me crea lo siguiente:

Ver imagen fondo1 al final de mensaje

Y solo me coloca la página 1
Aparece en el mensaje: Cabecera, informe (Página 1) y firma.
Hasta más o menos no está mal. Pero cuando el informe solo tiene una página no coloca la firma y el final del mensaje queda así:

Ver imagen fondo2 a lfinal de mensaje

Como podéis observa falta la línea donde pone “Primero Anterior Siguiente Último” ya que el informe solo tiene una página.
¿Alguien sabe la solución?
Estos son los códigos de VBA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Public Sub MAIL()
resultado = MsgBox("PULSA SI PARA VER O IMPRIMIR INFORME" & vbCrLf & vbCrLf & "PULSA NO PARA ENVIAR INFORME POR CORREO", vbYesNoCancel, TITULO_INFO)
 
    If resultado = vbYes Then
                resultado = MsgBox("PULSA SI PARA VER INFORME" & vbCrLf & vbCrLf & "PULSA NO PARA IMPRIMIR INFORME", vbYesNoCancel, TITULO_INFO)
                If resultado = vbYes Then DoCmd.OpenReport TITULO_CON, acViewPreview
                If resultado = vbNo Then DoCmd.OpenReport TITULO_CON, acPRINT
                If resultado = vbCancel Then Exit Sub
    Exit Sub
    End If
 
    If resultado = vbNo Then
    DoCmd.OutputTo acOutputReport, TITULO_CON, acFormatHTML, "Z:\TRAZABILIDAD\INFORMES\TITULO_HTML.html", False, ""
    InsertaMAIL "Z:\TRAZABILIDAD\INFORMES\TITULO_HTML.html"
    End If
 
 
    If resultado = vbCancel Then
    MsgBox "PROCESO CANCELADO", vbExclamation, TITULO_INFO
    End If
 
End Sub
 
 
Public Sub InsertaMAIL(strFile As String)
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
    Dim strTo As String
    Dim fso As Scripting.FileSystemObject
    Dim tsTextIn As Scripting.TextStream
    Dim strTextIn As String
    Set fso = New Scripting.FileSystemObject
    Set tsTextIn = fso.OpenTextFile(strFile)
    strTextIn = tsTextIn.ReadAll
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
 
strbody = "<html> <body>" & "<font face=calibri>Buenas Jose Manuel.<br>"
strbody = strbody & "<font=calibri>Necesitamos la compra del siguiente material:<br><br>"
strbody = strbody & "</body> </html>"
strfull = strTextIn & "</body> </html>"
 
On Error Resume Next
    With OutMail
    .Display
        .To = PARA
        .CC = COPIA
        .Subject = SUJETO & " " & TITULO_INFO & " " & Date
        .HTMLBody = strbody & strTextIn & .HTMLBody
     End With
 
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
 
End Sub

Gracias

fondo1
fondo2
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder