I have created a Word 2003 form. I would like to develop a simple Macro
that emails this Word form, as an attachment, to a distribution list (or
individual recipients). I use an Exchange 2003 server.
Any links or suggestions to get me started would be appreciated.

Aaron Neunz

Re: SEND by Jean-Guy

Jean-Guy
Thu Sep 29 08:33:17 CDT 2005

Aaron Neunz was telling us:
Aaron Neunz nous racontait que :

> I have created a Word 2003 form. I would like to develop a simple
> Macro that emails this Word form, as an attachment, to a distribution
> list (or individual recipients). I use an Exchange 2003 server.
> Any links or suggestions to get me started would be appreciated.
>
> Aaron Neunz

See
http://word.mvps.org/faqs/interdev/SendMail.htm
to get you started.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: SEND by Aaron

Aaron
Thu Sep 29 10:09:12 CDT 2005

This code is working great except the displayname property.
Even though I am setting this property it is not appearing as the message
body when the email is sent.


"Jean-Guy Marcil" <NoSpam@LeaveMeAlone> wrote in message
news:exefapPxFHA.1456@TK2MSFTNGP11.phx.gbl...
> Aaron Neunz was telling us:
> Aaron Neunz nous racontait que :
>
>> I have created a Word 2003 form. I would like to develop a simple
>> Macro that emails this Word form, as an attachment, to a distribution
>> list (or individual recipients). I use an Exchange 2003 server.
>> Any links or suggestions to get me started would be appreciated.
>>
>> Aaron Neunz
>
> See
> http://word.mvps.org/faqs/interdev/SendMail.htm
> to get you started.
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>



Re: SEND by Jean-Guy

Jean-Guy
Thu Sep 29 12:01:46 CDT 2005

Aaron Neunz was telling us:
Aaron Neunz nous racontait que :

> This code is working great except the displayname property.
> Even though I am setting this property it is not appearing as the
> message body when the email is sent.
>

Can you post the exact code you are using?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: SEND by Aaron

Aaron
Thu Oct 06 11:27:11 CDT 2005

Yes it is:

Sub SendPollingPlaceChangeFormAsAttachment()
'
' PollingPlaceChangeForm Macro
' Macro created 9/28/2005 by Aaron Neunz

Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If

Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "aneunz@scboedom.gov"
.Subject = "A POLLING LOCATION HAS BEEN CHANGED"
'Add the document as an attachment, you can use the .displayname
property
'to set the description that's used in the message
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
DisplayName:="Document as Attachment"
.Send
End With

If bStarted Then
oOutlookApp.Quit
End If

Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub

Also, say I create a new document from my template project. I save this
Word document with a filename and send it via email to another user. I do
not want them to have the ability to click on the macro toolbar button
referencing this code. How can I remove the reference to the template in
the new document?
Thanks

"Jean-Guy Marcil" <NoSpam@LeaveMeAlone> wrote in message
news:uhEU83SxFHA.1256@TK2MSFTNGP09.phx.gbl...
> Aaron Neunz was telling us:
> Aaron Neunz nous racontait que :
>
>> This code is working great except the displayname property.
>> Even though I am setting this property it is not appearing as the
>> message body when the email is sent.
>>
>
> Can you post the exact code you are using?
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>



Re: SEND by Jean-Guy

Jean-Guy
Thu Oct 06 14:49:43 CDT 2005

Aaron Neunz was telling us:
Aaron Neunz nous racontait que :

> Yes it is:
>
> Sub SendPollingPlaceChangeFormAsAttachment()
> '
> ' PollingPlaceChangeForm Macro
> ' Macro created 9/28/2005 by Aaron Neunz
>
> Dim bStarted As Boolean
> Dim oOutlookApp As Outlook.Application
> Dim oItem As Outlook.MailItem
>
> On Error Resume Next
>
> If Len(ActiveDocument.Path) = 0 Then
> MsgBox "Document needs to be saved first"
> Exit Sub
> End If
>
> Set oOutlookApp = GetObject(, "Outlook.Application")
> If Err <> 0 Then
> Set oOutlookApp = CreateObject("Outlook.Application")
> bStarted = True
> End If
>
> Set oItem = oOutlookApp.CreateItem(olMailItem)
>
> With oItem
> .To = "aneunz@scboedom.gov"
> .Subject = "A POLLING LOCATION HAS BEEN CHANGED"
> 'Add the document as an attachment, you can use the .displayname
> property
> 'to set the description that's used in the message
> .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue,
> _ DisplayName:="Document as Attachment"
> .Send
> End With
>
> If bStarted Then
> oOutlookApp.Quit
> End If
>
> Set oItem = Nothing
> Set oOutlookApp = Nothing
>
> End Sub
>
> Also, say I create a new document from my template project. I save
> this Word document with a filename and send it via email to another
> user. I do not want them to have the ability to click on the macro
> toolbar button referencing this code. How can I remove the reference
> to the template in the new document?
> Thanks

Your code looks fine.
I think that there is some misunderstanding regarding what DisplayName does.
It adds a label tot he attachment, not text in the email body.
Instead of ".Send" in the code, use ".Display". Then, whit the message on
screen, from the Format menu in Outlook, change the email to "Plain Text,"
then to "RTF." The attachment should wind up at the bottom of the message in
the email body space. Right click on it and select "Properties." You will
see that your DisplayName is indeed there, in the Label field.

As for your second question, if you create a document from a template, and
then send the document, not the template, the recipient will not have the
code. Unlike Excel, when you create a document from a template, the code
stays in the template.


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org