Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2020, 07:26 AM
ActualJax ActualJax is offline Help to get a word document to send specific content via email using submit button Windows 10 Help to get a word document to send specific content via email using submit button Office 2016
Novice
Help to get a word document to send specific content via email using submit button
 
Join Date: Jul 2020
Posts: 1
ActualJax is on a distinguished road
Default Help to get a word document to send specific content via email using submit button

Hi


I'm new here, and new to Word VBA.
I've been hunting around for information online for some time and am failing miserably to find what I want, I was hoping someone here may be able to help me, or at least let me know that what I want to do is not possible.


This feels like a big ask, but I am hoping the answer is obvious - also if anyone has a link to a site with resources that have the answers to my queries then I'm happy to research myself.


I've set up a form in word using controls and I assumed that if I gave them tags that I would be able to pull through whatever was written or selected in these fields to a certain area in an email, i.e. include the content of a control in the subject of an email.


I have a control I've tagged as 'System' - this is a picklist of various systems, lets say sys1, sys2, sys3.
I want this to appear after a string. So if I have -


With EmailItem
.Subject = "WO: RFW "


What do I enter after this to get it to pick up what was entered in the System field?


Also I want to be able to allow users to embed other documents in the form. Is it possible to input a control field that gives them the Browse function to upload?
If there is, how would I get these documents included as attachments to the email that will be generated when the click submit?


Any and all help would be greatly appreciated. I have spent days/weeks hunting for this and I'm just not finding it, or maybe I just don't get it.


Thank you (so much) in advance


Jacqui
Reply With Quote
  #2  
Old 07-06-2020, 04:12 PM
Guessed's Avatar
Guessed Guessed is offline Help to get a word document to send specific content via email using submit button Windows 10 Help to get a word document to send specific content via email using submit button Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

For your first question, try
.Subject = "WO: RFW " & ActiveDocument.SelectContentControlsByTag("System" )(1).Range.Text

For the attachments, I would assume there are two ways to approach this:
1. Actually embed the attachments into the Word doc and then work out how to extract them for the email
2. Create a list of filepaths and then have the email attachments built from these filepath strings.

Personally, I would expect the second method to be easier to code and less error prone.

The browse function is not something you would find as a native function in the Content Controls but it could be coded and executed either by entering a Content Control or maybe by a button on the ribbon. The code to select a file is often called FilePicker and there are plenty of samples showing how you use it. You could start here FileDialog object (Office) | Microsoft Docs or do a search for other examples.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 07-06-2020, 04:18 PM
gmaxey gmaxey is offline Help to get a word document to send specific content via email using submit button Windows 10 Help to get a word document to send specific content via email using submit button Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,421
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

It appears that Andrew's code line has extraneous white space after "System"
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email button in word document ajh19742000 Word 1 07-21-2019 02:18 AM
Help to get a word document to send specific content via email using submit button Submit Button Req that populates email address phorsley Word VBA 1 10-17-2017 04:50 PM
Submit to Email Command Button rob7676 Word VBA 0 08-20-2015 05:05 AM
Help to get a word document to send specific content via email using submit button VBA Code for a SUBMIT button in a Word form BlueMax Word VBA 3 08-07-2013 06:26 AM
Adding an Email Button to a Word Document maddoktor Word 0 12-01-2011 01:32 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft