none
When pressing the Email address in a world templates I want the template to be attached to a new mail (outlook) ! RRS feed

  • Question

  • Dear All,<o:p></o:p>

     

    I have created a template, in  my template there is a field called E-mail: xyz@gmail.com  (Merge Field).<o:p></o:p>

     

    I want when I press at the E-mail, the template would be attached to a new mail and the mail body would be for example empty.<o:p></o:p>

    so again when pressing the mail the whole template would be attached to anew mail :)<o:p></o:p>

     

    Can you please help me, and please provide me with details coz this is all new for me.<o:p></o:p>

     

    Thanks a lot,<o:p></o:p>

    Zayed<o:p></o:p>


    Friday, August 15, 2014 2:37 PM

Answers

  • Hi Zayed

    What Word itself offers in the way of capability depends on which version of Word you're using. In 2010 (and probably also in 2007 and 2013) there's an internal command that will send the current file as an email attachment:

       CommandBars.ExecuteMso("FileSendAsAttachment")

    This will display an Outlook email message with the file already attached.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Consultant_606 Wednesday, August 20, 2014 1:14 PM
    Friday, August 15, 2014 3:42 PM
    Moderator

All replies

  • Hello Zayed,

    Most probably you need to automate Outlook from Word to get the job done. See How to automate Outlook from another program for more information. Also you may find the Getting Started with VBA in Outlook 2010 article helpful.

    Friday, August 15, 2014 3:20 PM
  • Hi Zayed

    What Word itself offers in the way of capability depends on which version of Word you're using. In 2010 (and probably also in 2007 and 2013) there's an internal command that will send the current file as an email attachment:

       CommandBars.ExecuteMso("FileSendAsAttachment")

    This will display an Outlook email message with the file already attached.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Consultant_606 Wednesday, August 20, 2014 1:14 PM
    Friday, August 15, 2014 3:42 PM
    Moderator
  • Hi,

    I checked your link it just show me that my idea in general is possible. but it did not shoe me the way, here in this link I can only see that I can write a code and create a button which will excute my code.

    But what I wanted is different! I wanted to press the customer email and then a new outlook message would be opened :)

    how can I do this, I want to tell the code something like take the value from this Merge field and create a new mail with it.

    Thanks,

    Zayed

    Monday, August 18, 2014 7:13 AM
  • Yes, Zayed, see my reply to you. Use the code I propose for your Ribbon button and you should see what you ask...

    Cindy Meister, VSTO/Word MVP, my blog

    Monday, August 18, 2014 3:34 PM
    Moderator
  • Once again thanks. but your code open anew mail with the file attached. but what about the receiver email? I want to provide also the receiver email. I want the word button to take it from one of my templates merge fields.

    Thanks,

    Zayed

    Wednesday, August 20, 2014 2:39 PM
  • want to email a word form doc to a certain address once the user completes filling out the form.  I tried this macro button  { MacroButton FileSendMail Click here to submit the form }.  This opens the user's email application and attaches the form to the email.  Fine so far.  Now, how can I auto populate the email message title  and the email send to?  I use Word 2011 for win
    Thanks for any help.
    Wednesday, August 20, 2014 2:49 PM
  • Hello Zayed,

    You can do this manually.

    Or you can handle the process of sending the email programmatically. To get this done you need to automate Outlook. The process is described in depth in the following articles:

    How to automate Outlook from another program

    Using Automation to Send a Microsoft Outlook Message

    Wednesday, August 20, 2014 4:15 PM
  • Hi Eugene,

    I found this code in the link that you gave to me, would you tell me how to edit it?

    again I just want to attached opened templates to an outlook mail and take the receiver mail from the templates mere fields. lets say I have a merge field called {Merge field Customer Email}, how to send it to this customer? is this possible. 

    Sub CreateNewContactFromCustomForm()
    
       Dim ol As Outlook.Application
       Dim olns As Outlook.NameSpace
       Dim objFolder As Outlook.MAPIFolder
       Dim AllContacts As Outlook.Items
       Dim NewContact As Outlook.ContactItem
    
       ' Set the Application object.
       Set ol = New Outlook.Application
    
       ' Set the Namespace object.
       Set olns = ol.GetNamespace("MAPI")
    
       ' Set the default Contacts folder.
       Set objFolder = olns.GetDefaultFolder(olFolderContacts)
    
       ' Set objAllContacts equal to the collection of all contacts.
       Set AllContacts = objFolder.Items
    
       ' Add a new contact to the AllContacts collection using the
       ' "IPM.Contact.MyForm" form.
       Set NewContact = AllContacts.Add("IPM.Contact.MyForm")
    
       ' Display the new contact form.
       NewContact.Display
    
    End Sub
    

    Thanks a lot,

    Zayed

    Thursday, August 21, 2014 6:30 AM