Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

email a word document from an ms-access application

Discussion in 'Information Technology' started by rogereverest, Jul 28, 2006.

  1. rogereverest

    rogereverest
    Expand Collapse
    Guest

    I wish to be able to email a word document automatically from an access
    application. Is it possible to due this without entering the email address
    and recipients details into Outlook Express first? I hold the recipients
    name and email address in my access database.
     
  2. Loading...


  3. Jeff C

    Jeff C
    Expand Collapse
    Guest

    Yes:

    Private Sub Command5_Click()
    DoCmd.OutputTo acOutputReport, "NameOfAccessReport", acFormatRTF,
    "FullNameAndPathOfOutputFile"

    Dim wdApp As Word.Application
    Dim doc As Word.Document

    Set wdApp = New Word.Application
    Set doc = wdApp.Documents.Open("FullNameAndPathOfOutputFile")
    wdApp.Run "NameOfMacro"
    wdApp.Quit False
    Set doc = Nothing
    Set wdApp = Nothing

    Kill ("FullNameAndPathOfOutputFile")

    End Sub

    Sub NameOfMacro()

    Set Report = ActiveDocument.MailEnvelope.Item
    Report.To = "RecipientEmailAddress"
    Report.Subject = "WhatEverYouWant"
    Report.Send
    End Sub


    Place the name of your textbopx holding the email address in the mail
    recipient line
    --
    Jeff C
    Live Well .. Be Happy In All You Do


    "rogereverest" wrote:

    > I wish to be able to email a word document automatically from an access
    > application. Is it possible to due this without entering the email address
    > and recipients details into Outlook Express first? I hold the recipients
    > name and email address in my access database.
     
  4. rogereverest

    rogereverest
    Expand Collapse
    Guest

    Jeff C Thanks for your help, however I have a problem whereby you refer to
    "NameOfAccessReport". I have no report specified, only the Path & Name of the
    Word Document I want to send. I must be missing something in your thinking -
    sorry to be a pain

    "Jeff C" wrote:

    > Yes:
    >
    > Private Sub Command5_Click()
    > DoCmd.OutputTo acOutputReport, "NameOfAccessReport", acFormatRTF,
    > "FullNameAndPathOfOutputFile"
    >
    > Dim wdApp As Word.Application
    > Dim doc As Word.Document
    >
    > Set wdApp = New Word.Application
    > Set doc = wdApp.Documents.Open("FullNameAndPathOfOutputFile")
    > wdApp.Run "NameOfMacro"
    > wdApp.Quit False
    > Set doc = Nothing
    > Set wdApp = Nothing
    >
    > Kill ("FullNameAndPathOfOutputFile")
    >
    > End Sub
    >
    > Sub NameOfMacro()
    >
    > Set Report = ActiveDocument.MailEnvelope.Item
    > Report.To = "RecipientEmailAddress"
    > Report.Subject = "WhatEverYouWant"
    > Report.Send
    > End Sub
    >
    >
    > Place the name of your textbopx holding the email address in the mail
    > recipient line
    > --
    > Jeff C
    > Live Well .. Be Happy In All You Do
    >
    >
    > "rogereverest" wrote:
    >
    > > I wish to be able to email a word document automatically from an access
    > > application. Is it possible to due this without entering the email address
    > > and recipients details into Outlook Express first? I hold the recipients
    > > name and email address in my access database.
     

Share This Page