![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I'm using the DoCmd.SendObject command to email shipping documents. Often there is more than one document to be emailed, but when I use the DoCmd.SendObject I can't see an option for more than one object, and it ends up being multiple emails with single attachments. Does anyone know how to automate attaching multiple objects to a single email? Thanks, Franc. |
#3
| |||
| |||
|
|
I'm using the DoCmd.SendObject command to email shipping documents. Often there is more than one document to be emailed, but when I use the DoCmd.SendObject I can't see an option for more than one object, and it ends up being multiple emails with single attachments. Does anyone know how to automate attaching multiple objects to a single email? |
#4
| |||
| |||
|
|
SendObject's twenty limitations |
#5
| |||
| |||
|
|
"franc sutherland" <franc.sutherland (AT) googlemail (DOT) com> wrote in message news:3c9f84ff-4cdc-428a-a3a4-31eec4ea9eae (AT) d21g2000prf (DOT) googlegroups.com... Hi, I'm using the DoCmd.SendObject command to email shipping documents. Often there is more than one document to be emailed, but when I use the DoCmd.SendObject I can't see an option for more than one object, and it ends up being multiple emails with single attachments. Does anyone know how to automate attaching multiple objects to a single email? Thanks, Franc. Here is a function I put together with examples from this group '--------------------- ' Create a email with attachments ' stSendTo Email address ' stBody Body of the message ' stSubject Subject of the message ' astAttach Array of strings listing the path to the attachments ' intAcount Number of attachments ' intSend True if the message should be sent without preview Public Function EmailAttach(ByRef stSendTo As String, ByRef stBody As String, ByRef stSubject As String, _ astAttach() As String, intAcount As Integer, intSend As Integer) As Integer On Error GoTo errEmailAttach Dim oLook As Object Dim oMail As Object Dim i As Integer Set oLook = CreateObject("Outlook.Application") Set oMail = oLook.CreateItem(0) With oMail .To = stSendTo .Body = stBody .Subject = stSubject .ReadReceiptRequested = True If intAcount <> 0 Then For i = 1 To intAcount .Attachments.Add (astAttach(i - 1)) Next End If If intSend = True Then .Send Else .Display End If End With Set oMail = Nothing Set oLook = Nothing EmailAttach = True Exit Function errEmailAttach: MsgBox "The following error was noted : " & Err.Description & Chr$(10) & Chr$(13) & _ "Your email may not have been sent.", vbCritical, "Error" On Error Resume Next Set oMail = Nothing Set oLook = Nothing EmailAttach = False End Function |
#6
| |||
| |||
|
|
Hi, Thanks for taking a look. I'm afraid I can't get it to work however. How do I input the array showing the locations of the objects to send? |
|
The final variable says ' ) as integer'. I don't know what to put in there? |
|
Sorry to be a pain, I'm still quite new to this stuff. Thanks, Franc. paii, Ron wrote: "franc sutherland" <franc.sutherland (AT) googlemail (DOT) com> wrote in message news:3c9f84ff-4cdc-428a-a3a4-31eec4ea9eae (AT) d21g2000prf (DOT) googlegroups.com... Hi, I'm using the DoCmd.SendObject command to email shipping documents. Often there is more than one document to be emailed, but when I use the DoCmd.SendObject I can't see an option for more than one object, and it ends up being multiple emails with single attachments. Does anyone know how to automate attaching multiple objects to a single email? Thanks, Franc. Here is a function I put together with examples from this group '--------------------- ' Create a email with attachments ' stSendTo Email address ' stBody Body of the message ' stSubject Subject of the message ' astAttach Array of strings listing the path to the attachments ' intAcount Number of attachments ' intSend True if the message should be sent without preview Public Function EmailAttach(ByRef stSendTo As String, ByRef stBody As String, ByRef stSubject As String, _ astAttach() As String, intAcount As Integer, intSend As Integer) As Integer On Error GoTo errEmailAttach Dim oLook As Object Dim oMail As Object Dim i As Integer Set oLook = CreateObject("Outlook.Application") Set oMail = oLook.CreateItem(0) With oMail .To = stSendTo .Body = stBody .Subject = stSubject .ReadReceiptRequested = True If intAcount <> 0 Then For i = 1 To intAcount .Attachments.Add (astAttach(i - 1)) Next End If If intSend = True Then .Send Else .Display End If End With Set oMail = Nothing Set oLook = Nothing EmailAttach = True Exit Function errEmailAttach: MsgBox "The following error was noted : " & Err.Description & Chr$(10) & Chr$(13) & _ "Your email may not have been sent.", vbCritical, "Error" On Error Resume Next Set oMail = Nothing Set oLook = Nothing EmailAttach = False End Function |
#7
| |||
| |||
|
|
SendObject's twenty limitations I can let you have some room on my site if you'd like to list them all! :-) |
![]() |
| Thread Tools | |
| Display Modes | |
| |