D
dworst
I've created a word form with 4 radio buttons on it and a command
button. Inside of my code for the button I want the button upon click
to evaluate which radio button is true and then perform a function.
Below is what I have so far but it doesn work correctly. Could anyone
guide me as to what I'm doing incorrectly?
Thanks so much!.
Sub SendDocumentAsAttachment2()
Dim vmailbox
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
Set oOutlookApp = New Outlook.Application
If Err <> 0 Then
Set oOutlookApp = New Outlook.Application
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
vmailbox = " "
Select Case Yes214.Value
Case True
vmailbox = "(e-mail address removed)"
End Select
Select Case Yes215.Value
Case True
vmailbox = "DL-GAI.ITServices.Database.Services"
End Select
Select Case Yes216.Value
Case True
vmailbox = "(e-mail address removed)"
End Select
Select Case Yes2141.Value
Case True
vmailbox = "DL-GAI.ITServices.Info.Services.Informatica"
End Select
Select Case text13.Value
Case True
vmailbox = text13
Case Else
vmailbox = ""
End Select
With oItem
.To = vmailbox
.Subject = ActiveDocument.Name
'Add the document as an attachment, you can use the .displayname
property
'to set the description that's used in the message
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue,
DisplayName:="Document as attachment"
.Display
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
button. Inside of my code for the button I want the button upon click
to evaluate which radio button is true and then perform a function.
Below is what I have so far but it doesn work correctly. Could anyone
guide me as to what I'm doing incorrectly?
Thanks so much!.
Sub SendDocumentAsAttachment2()
Dim vmailbox
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
Set oOutlookApp = New Outlook.Application
If Err <> 0 Then
Set oOutlookApp = New Outlook.Application
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
vmailbox = " "
Select Case Yes214.Value
Case True
vmailbox = "(e-mail address removed)"
End Select
Select Case Yes215.Value
Case True
vmailbox = "DL-GAI.ITServices.Database.Services"
End Select
Select Case Yes216.Value
Case True
vmailbox = "(e-mail address removed)"
End Select
Select Case Yes2141.Value
Case True
vmailbox = "DL-GAI.ITServices.Info.Services.Informatica"
End Select
Select Case text13.Value
Case True
vmailbox = text13
Case Else
vmailbox = ""
End Select
With oItem
.To = vmailbox
.Subject = ActiveDocument.Name
'Add the document as an attachment, you can use the .displayname
property
'to set the description that's used in the message
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue,
DisplayName:="Document as attachment"
.Display
End With
If bStarted Then
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub