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 one of the option buttons said
-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
For example, let's say one of the option buttons said
-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