View Single Post
  #2 (permalink)  
Old 07-24-2008, 04:06 PM
Arvin Meyer [MVP]
 
Posts: n/a
Re: command to send an e-mail

Add a line immediately before the line:

..Send

so that it looks like:

..Display
..Send

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Pietro" <Pietro@discussions.microsoft.com> wrote in message
news:85D117A5-22E9-4E02-9035-1B4F8E8DD66B@microsoft.com...
> Hi,
>
> I'm using the below command to send an e-mail,I need the message to open
> before sending,so that i may put the To and CC fields.
>
> The code is
>
> Dim mess_body As String
> Dim appOutLook As Outlook.Application
> Dim MailOutLook As Outlook.MailItem
> Dim a As String
> Set appOutLook = CreateObject("Outlook.Application")
> Set MailOutLook = appOutLook.CreateItem(olMailItem)
>
>
> DoCmd.SelectObject acQuery, "Tier2 Current Month Report", True
> Me.Requery
> DoCmd.TransferSpreadsheet acExport, 8, "Tier2 Current Month Report",
> "O:\XBOX\XBOX-Tier2\Customer Support\Source\Reports\Current Month
> Report.xls"
>
>
> 'Application.SetOption "Show Hidden Objects", False
> 'DoCmd.RunCommand acCmdWindowHide
> ' DoCmd.SelectObject acForm, "Main page", False
> ' DoCmd.Maximize
>
> Set appOutLook = CreateObject("Outlook.Application")
> Set MailOutLook = appOutLook.CreateItem(olMailItem)
>
> With MailOutLook
> .BodyFormat = olFormatHTML
> .to = ""
> .CC = ""
> .Subject = "Current Month Report"
> .HTMLBody = "<P>Dear All<P>" & _
> "<P>Kindly find attached Tier2 Current Month
> Report</P>" & _
> "<P>Best Regards<P>" & _
> "Customer Support Tool</P>"
>
>
>
> If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
> .Attachments.add (Me.Mail_Attachment_Path)
>
> End If
> Application.Echo False
> DoCmd.SelectObject acTable, "", True
> DoCmd.RunCommand acCmdWindowHide
> Application.Echo True
>
> '.DeleteAfterSubmit = True 'This would let Outlook send th
> note without storing it in your sent bin
> .Send
> End With
> 'MsgBox MailOutLook.Body
> Exit Sub
>
>
>
> email_error:
> MsgBox "An error was encountered." & vbCrLf & "The error
> message
> is: " & Err.Description
> Resume Error_out
> Error_out:



Reply With Quote