learning321A
Member
- Outlook version
- Outlook 2016 64 bit
- Email Account
- Office 365 Exchange
Okay, I have been trying, and I added that piece as well but it still does not do anything. no errors, but when I hit reply or reply all, nothing changes. I tried to add a picture here but it only lets me add urls. I have this code all in the ThisOutlookSession box. What am I doing wrong? I have macro security set to low, and normal modules execute when i click on Run.
Private Sub afterReply()
oResponse.Display
' get the recipient names
Dim Recipients As Outlook.Recipients
Dim R As Outlook.Recipient
Dim i
Dim strTo As String, strCC As String
Set Recipients = oResponse.Recipients
For i = 1 To Recipients.Count
Set R = Recipients.Item(i)
Debug.Print R.Name, R.Type
If R.Type = olCC Then
strCC = R.Name & ", " & strCC
Else
strTo = R.Name & ", " & strTo
End If
Next
'insert the names
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection
olSelection.InsertBefore "CC: " & strCC
olSelection.InsertParagraphBefore
olSelection.InsertBefore "To: " & strTo
End Sub
Private Sub afterReply()
oResponse.Display
' get the recipient names
Dim Recipients As Outlook.Recipients
Dim R As Outlook.Recipient
Dim i
Dim strTo As String, strCC As String
Set Recipients = oResponse.Recipients
For i = 1 To Recipients.Count
Set R = Recipients.Item(i)
Debug.Print R.Name, R.Type
If R.Type = olCC Then
strCC = R.Name & ", " & strCC
Else
strTo = R.Name & ", " & strTo
End If
Next
'insert the names
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection
olSelection.InsertBefore "CC: " & strCC
olSelection.InsertParagraphBefore
olSelection.InsertBefore "To: " & strTo
End Sub