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?
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
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