|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Is it possible to send only columns of a word document to different mails, at once?
Hello :-)
I'm new to this forum, and my word-skills is pretty basic. I'm looking for a way to auto-isolate columns from a Word document, based on the initials of a person writtin in the column, and then the possibility to email it to the specific person. Does it make any sense to You guys? An example could be that I want to isolate and send the line which includes the "AHK" to his email: "Meeting (0011) - HGK (initials, some randoms word, bla bla. Meeting (0012) - AHK (initials), some randoms words, bla bla." I'm hoping for some cool solutions :-) Thanks so much for Your time! |
#2
|
||||
|
||||
You could use a macro
The following will copy the selected text to an e-mail message. NOTE the comment at the top of the macro. Code:
Sub Send_Extract_As_EMail() 'Graham Mayor - https://www.gmayor.com - Last updated - 20 Apr 2021 'Requires the code - http://www.rondebruin.nl/win/s1/outlook/openclose.htm 'to either retrieve an open instance of Outlook or open Outlook if it is closed. Dim OlApp As Object Dim oItem As Object Dim outNS As Object Dim objDoc As Word.Document Dim objSel As Selection Dim strEmail As String strEmail = "<PR_EMAIL_ADDRESS>" 'Let the user choose the contact from Outlook 'And assign the email address to a variable strEmail = Application.GetAddress("", strEmail, _ False, 1, , , True, True) If strEmail = "" Then MsgBox "User cancelled or no address listed", , "Cancel" GoTo lbl_Exit End If Set OlApp = OutlookApp() 'Create a new mailitem Set outNS = OlApp.GetNamespace("MAPI") outNS.logon Set oItem = OlApp.CreateItem(0) Set objDoc = oItem.GetInspector.WordEditor Set objSel = objDoc.Windows(1).Selection With oItem .To = strEmail .Subject = InputBox("Subject?") Selection.Copy .Display objSel.Paste End With lbl_Exit: 'Clean up Set oItem = Nothing Set OlApp = Nothing Set objSel = Nothing Set outNS = Nothing Set objDoc = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks for the fast reply!
As said, I'm pretty basic, though I do know where to make macros. I just dont understand them. Your comment at the top -> Does it mean that I have to go to the link and download something, or Is it just an example? Will I be able to make a shortcut to that macro, and then just select some text, click the shortcut, and then it will send a mail to the selected emailadress? |
#4
|
||||
|
||||
The answer to both your questions is yes. The link has a function to copy that you will need. As for the button - see Installing Macros
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to send out the mails automatically | boddulus | Excel Programming | 0 | 07-29-2018 05:35 PM |
Setup Outlook to ONLY SEND mails ? | ksor | Outlook | 0 | 03-14-2018 06:07 AM |
Outlook not able to send e-mails | aimforgold | Outlook | 0 | 11-01-2014 11:15 AM |
Outlook 2010 Will Not Send E-Mails To Certain Users | J3V | Outlook | 8 | 02-20-2013 06:47 PM |
How to send mails from outlook to gmail | crks | Outlook | 1 | 01-21-2011 04:33 PM |