![]() |
#1
|
|||
|
|||
![]()
I have a word document that, upon clicking a button, attaches itself to an email. I have 10 option buttons that I would like the user to choose from, to designate who should receive the email address. How can I change my code to allow the VBA to select the corresponding email address for that option button and send it only to them?
For example, let's say the option buttons were: -Sally -Mark If my user selected Sally, my code would say "If opt_Sally, then shenderson@fakecompany.com; elseif opt_Mark, then mrichardson@fakecompany.com" ------------------------------------------- Private Sub CommandButton1_Click() Dim OL As Object Dim EmailItem As Object Dim Doc As Document Application.ScreenUpdating = False Set OL = CreateObject("Outlook.Application") Set EmailItem = OL.CreateItem(olMailItem) Set Doc = ActiveDocument Doc.Save With EmailItem .Subject = "New Vehicle Equipment Trouble Report" .To = .Attachments.Add Doc.FullName .Display '.Send End With Application.ScreenUpdating = True Set Doc = Nothing Set OL = Nothing Set EmailItem = Nothing |
#2
|
||||
|
||||
![]()
See attached. Save the document as a macro enabled template and create new documents from it.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
send to email recipient option wont work | tomer | Outlook | 0 | 03-28-2019 07:32 AM |
![]() |
Dsr122076 | Mail Merge | 1 | 12-03-2015 04:19 PM |
Setting a particular table cell background color when an option button is selected in Word 2007 | a888 | Word VBA | 11 | 03-25-2015 05:33 AM |
![]() |
ksigcajun | Word VBA | 1 | 01-15-2015 01:36 PM |
Help on option button active X | aligahk06 | Excel | 0 | 11-03-2009 11:39 PM |