Hello,
I need to be able to attach files (not msaccess internal objects).
I found the "CDO.Message" way. I'm about to give it a try.
Thanks for your answer.
John
:
Hi John,
what is it that you are trying to send... an Access report perhaps? If
so, this code uses the dafault email application...
'~~~~~~~~~~~~~~~~~~~~~~~
'================================================================= Email
'SendObject
'[objecttype]
'[, objectname]
'[, outputformat]
'[, to]
'[, cc]
'[, bcc]
'[, subject]
'[, messagetext]
'[, editmessage]
'[, templatefile]
'------------------------------------ EMailReport
Sub EMailReport( _
pReportName As String _
, pEmailAddress As String _
, pFriendlyName As String _
, pBooEditMessage As Boolean _
, pWhoFrom As String _
, Optional ByVal pFormat As String)
'Email a report to someone and construct the subject and message
'SNAPSHOT Format
'example useage: on the command button code to process a report
' EMailReport "rptSonglist", "(e-mail address removed)", _
"A List of the Original Songs from an upcoming Star", _
false, "Susan Manager"
'PARAMETERS
'pReportName --> "rptSonglist"
'pEmailAddress --> "(e-mail address removed)"
'pFriendlyName --> "List of the Original Songs from upcoming Star"
'pBooEditMessage --> true to edit message before mail is sent
' --> false send automatically
'pWhoFrom --> "Susan Manager"
On Error GoTo Proc_Err
On Error Resume Next
Dim mFormat As String
If Len(Nz(pFormat)) = 0 Then
pFormat = "SNP"
End If
If pFormat <> "SNP" Then
mFormat = "Rich Text Format (*.rtf)"
Else
mFormat = "Snapshot Format (*.snp)"
End If
'----------------------- Email it
DoCmd.SendObject acSendReport, pReportName, mFormat, pEmailAddress _
, , , pFriendlyName & Format(Now(), " ddd m-d-yy h:nn am/pm"), _
pFriendlyName & " is attached --- " _
& "Regards, " & pWhoFrom, pBooEditMessage
Proc_Exit:
Exit Sub
Proc_Err:
MsgBox Err.Description, , "ERROR " & Err.Number & " EMailReport"
'press F8 to find problem and fix
' -- comment out next line when code is done
Stop: Resume
Resume Proc_Exit
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~
Warm Regards,
Crystal
*
have an awesome day
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
JohnA wrote:
You wrote:
If you are using Outlook Express, there is another method
Warm Regards,
Crystal
Microsoft Access MVP 2006
Could you please give me this "other method"?
I'm trying to send a mail through MSAccess, I have no problem with that, but
I can't send any attachments, because I'm using the "SendObject" way.
The "CreateObject("Outlook.Application")" way can send attachments, but I'm
using Outlook Express. I've tried
"CreateObject("OutlookExpress.Application")", but it didn't work.
Any ideas?
Many thanks,
John
:
for constructing Outlook messages from Access, here is some
code posted by Ricky Hicks ...
'~~~~~~~~~~~~~~~
Function MailParameters()
Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)
With outMsg
'.Importance = olImportanceHigh
.To = Me.eMailAddress
'.CC = "CC EMAIL ADDRESS GOES HERE"
'.BCC = "BCC EMAIL ADDRESS GOES HERE"
' .Subject = "YOUR SUBJECT GOES HERE"
' .Body = "YOUR_E-MAIL_MESSAGE_GOES_HERE"
'.Attachments.Add _
"YOUR FILE PATH AND NAME"
' If you want to edit before sending
.Display
'otherwise, to just send without looking...
'.Send
End With
Set outApp = Nothing
Set outMsg = Nothing
End Function
'~~~~~~~~~~~~~~~
If you are using Outlook Express, there is another method
Warm Regards,
Crystal
Microsoft Access MVP 2006
*
Have an awesome day
remote programming and training
strive4peace2006 at yahoo.com
*
scariharry wrote:
Is there anyway around this without using a third party? I've tried sendkeys,
saving to the outbox and others..... no cookie yet.
:
You can also use Redemption
http://www.dimastr.com/redemption/
-----Original Message-----
Download this program it will click yes automatically
http://www.snapfiles.com/get/clickyes.html