Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Customize Automatically Send Doc over Email

    Hi Everyone--

    Word 97, Win 95, Outlook 98. I'm trying to set up a document so that when you're done with it, you can click a button and an email with the document will automatically go to an Outlook (98) recipient. I've kind of fudged it with using routing, but it's not a great solution. I saw SendMail in there, but there seems to be no way to specify a recipient (at least not in the documentation). [This is one of those things when I go--Why can't it be just like Access???]

    The document I'm trying to send is a protected Word form, but I can't just put the form into Outlook because there's no way to protect it in there (so the user can tab through the form fields).

    I'm sure someone out there has done this before. Any ideas, or suggestions, no matter how crazy, are very welcome.

    Thanks!

    Cecilia :-)

  2. #2
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Pune
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Customize Automatically Send Doc over Email

    Have you considered using a PDF form (File extension *.fdf)?

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Customize Automatically Send Doc over Email

    EEEEEEECCCCCCKKKKKK!

    Actually, I found the answer elsewhere.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Customize Automatically Send Doc over Email

    Hi Cecilia:
    How about sharing the solution? It may be useful when others have this problem.

    Cheers,

  5. #5
    Star Lounger
    Join Date
    Mar 2001
    Location
    St Georges du Bois, Pays de la Loire
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Customize Automatically Send Doc over Email

    Phil,

    I do this all the time for our intranet. I use a control button located in a text frame for the e-mail button and a script from Chris Rae to e-mail.

    The code for the buttons:

    Private Sub link_to_index_Click()

    ActiveDocument.FollowHyperlink Address:= _
    "aide_memoire.htm", NewWindow:=False _
    , AddHistory:=True

    End Sub

    Private Sub print_form_Click()

    With ActiveDocument

    .Shapes(1).Visible = msoFalse
    .PrintOut Background:=False
    .Shapes(1).Visible = msoTrue

    End With

    End Sub

    Private Sub send_form_Click()

    MailDoc3

    End Sub

    Button 1 returns the user to the document index, button 2 prints the form without showing the button bar and 3 e-mails the form using the script below:

    Sub MailDoc3()


    ActiveDocument.SaveAs FileName:="bsg402.doc"



    ' Make instance
    Set myOutlook = CreateObject("Outlook.Application")
    ' Make mail item
    Set myMailItem = myOutlook.createitem(0)
    ' Set recipient (internal mail)


    myMailItem.Recipients.Add "Stroud, Phyl"
    myMailItem.Recipients.Add "Jones, Christine (SW)"

    myMailItem.Recipients.Add "Humanresources"
    myMailItem.Recipients.Add "SWSITESECURITY"


    ' Set subject
    myMailItem.Subject = "Starters & Leavers - Team Managers"
    ' Set body
    myMailItem.body = "The attached form BSG 402 contains personnel details for your attention."
    ' Set open doc as attachement
    myMailItem.Attachments.Add ActiveDocument.FullName
    ' And send it!
    myMailItem.send
    ' Close instance
    Set myOutlook = Nothing

    End Sub

    The mail macro came from Chris Rae here

    http://chrisrae.com/vba/routines/sendmail.html

    and the non-printing button bar from the MVP web:

    http://www.mvps.org/word/FAQs/TblsFldsFms/...PrintButton.htm

    David

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Customize Automatically Send Doc over Email

    Hi Solomod:
    I saw part of this in another thread you posted. I actually don't use Outlook for mail, but thank you for the info.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Customize Automatically Send Doc over Email

    I had thought of doing that at the time, but was away from my files....

    It's pretty much what Solomod has below:

    Public Sub MailDoc()
    On Error GoTo HandleError

    Dim myOutlook As Object
    Dim myMailItem As Object

    ActiveDocument.SaveAs ActiveDocument.Name
    Set myOutlook = CreateObject("Outlook.Application")
    Set myMailItem = myOutlook.createitem(0)

    myMailItem.Recipients.Add "recipient1"
    myMailItem.Recipients.Add "recipient2"

    myMailItem.Subject = "This is my subject"
    myMailItem.body = "This is my body"
    myMailItem.Attachments.Add ActiveDocument.FullName
    myMailItem.send

    Set myOutlook = Nothing

    Exit Sub
    HandleError:
    MsgBox "Report this error to ROMIG: " & vbCrLf & vbCrLf _
    & Err.Number & " " & Err.Description, , "Message Send Error"

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •