Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

una richiesta per "attachment" (allegare report a una mail)

32 views
Skip to first unread message

Luca Lombardini

unread,
Oct 30, 2020, 11:48:38 AM10/30/20
to
Buon giorno a tutti
In un database di Access, gestito su un pc con la runtime, se creo un invio di email tramite l'oggetto "Send object" con la seguente sintassi, mi genera un errore di run time che chiude l'applicazione sul pc dell'utente. mentre sul mio, che lavora senza la runtime, questo non succede.
ecco la sintassi che ho usato

DoCmd.SendObject acSendReport, "STATISTICHE generali", acFormatPDF, "PI...@PIOO.COM ; BAR...@BARBIE.COM", , , "Invio report mensile", "Buon giorno"

questa sintassi mi da quell'errore di run time...

volevo a questo punto provare la seguente routine, visto che in un altro punto del database c'è un altro pulsante che invia una tabella usando VBA e non da problemi di alcun tipo, solo che non so come allegare un report "al volo" senza salvarlo sul pc...
nel passaggio sotto citato
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
posso mettere una istruzione tipo me."nome report"...????
grazie mille a chivorrà aiutarmi, se possibile. buon WE a tutti
ecco la sintassi presa sul web

Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Andrew Fuller")
objOutlookRecip.Type = olCC

' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "Last test - I promise." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send

End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
0 new messages