Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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.
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page