• Calling outlook help (access 2003)

    Author
    Topic
    #444690

    I’m going back to an earlier post where I wanted to attach more than 1 thing to an email from access. The code below works but It will auto send the email. I want to be able to edit the email before it’s sent. I’m looking to have the email open before it’s sent. I tried a few things with th .send line but nothing worked. Any thoughts? Thanks..

    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject(“Outlook.Application”)
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    With MailOutLook
    .To = “gbanks@ets.org”
    .Subject = “Hey…”
    .HTMLBody = “Check It Out


    .Attachments.Add “C:tempdb2.xls”, olByValue, 1, “db2”
    .Attachments.Add “C:tempdb1.zip”, olByValue, 1, “Thing”
    .Send
    End With

    Viewing 1 reply thread
    Author
    Replies
    • #1076117

      Use .Display instead of .Send. You can then send it manualy from there.

    • #1076129

      For future reference: it would have been better to post your new question as a reply in the previous thread (starting at post 666,330 ) since it is a follow-up question.

      • #1076241

        Sorry about that Hans. I am very close to completeing this. I pasted the top part of my code below.. I was using the stlinkCriteria to show only the one record on the CPRreport that I eant to attach. It would pull this number from the form. It worked before when I used sendobject but I’m not sure how to use it now that I’m calling outlook. Any thoughts? Thanks..

        stLinkCriteria = “EIRID=” & Chr(34) & Me(“EIRID”) & Chr(34)

        This is the old code i used for DoCmd.SendObject

        ‘DoCmd.SendObject acReport, “CPRReport”, “RichTextFormat(*.rtf)”, “”, “”, “”, “Site CPR Attached”, “If you have any questions please respond to this email. Thank You…”, False, stLinkCriteria

        New part

        DoCmd.OutputTo ObjectType:=acOutputReport, _
        objectname:=”CPRReport”, _
        OutputFormat:=acFormatRTF, _
        OutputFile:=”F:CPRReport.rtf”, _
        Autostart:=True

        im appOutLook As Outlook.Application
        Dim MailOutLook As Outlook.MailItem
        Set appOutLook = CreateObject(“Outlook.Application”)
        Set MailOutLook = appOutLook.CreateItem(olMailItem)

        With MailOutLook
        .To = “gbanks@ets.org”
        .Subject = “Batch Releases”
        .HTMLBody = “Hello”
        .Attachments.Add “F:no CPR.doc”, olByValue, 1, “Incomplete test no CPR”
        .Attachments.Add “f:TempCPRReport.rtf”, olByValue, 1, “CPRReport_rpt.rtf”
        .Display
        End With

        • #1076245

          I’m afraid your use of stLinkCriteria in SendObject is invalid – the last argument specifies an HTML template, not a where-condition.

          You’ll have to change the record source of the report to a query that selects the desired record. The criteria for the EIRID field in the query would look like this:

          [Forms]![NameOfForm]![EIRID]

    Viewing 1 reply thread
    Reply To: Calling outlook help (access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: