Diane provided me with this code to select an entire email message and save it all in a 12 point font.
It worked great. Thank you.
I would like add code at the end of this to save the email. What code instructions would do that ?
Thank you,
Steve
Public Sub FormatSelectedText()
Dim objItem As Object
Dim objInsp As Outlook.Inspector
' Add reference to Word library
' in VBA Editor, Tools, References
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
'Reference the current Outlook item
Set objItem = Application.ActiveInspector.currentItem
If Not objItem Is Nothing Then
If objItem.Class = olMail Then
Set objInsp = objItem.GetInspector
If objInsp.EditorType = olEditorWord Then
Set objDoc = objInsp.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
If objDoc.ProtectionType = WdProtectionType.wdAllowOnlyReading Then objDoc.UnProtect
' replace the With block with your code
With objSel
.WholeStory
' Formatting code goes here
'.Font.Color = wdColorBlue
.Font.Size = 12
'.Font.Bold = True
'.Font.Italic = True
'.Font.Name = "Arial"
End With
End If
End If
End If
objItem.Save
Set objItem = Nothing
Set objWord = Nothing
Set objSel = Nothing
Set objInsp = Nothing
End Sub
It worked great. Thank you.
I would like add code at the end of this to save the email. What code instructions would do that ?
Thank you,
Steve
Public Sub FormatSelectedText()
Dim objItem As Object
Dim objInsp As Outlook.Inspector
' Add reference to Word library
' in VBA Editor, Tools, References
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
'Reference the current Outlook item
Set objItem = Application.ActiveInspector.currentItem
If Not objItem Is Nothing Then
If objItem.Class = olMail Then
Set objInsp = objItem.GetInspector
If objInsp.EditorType = olEditorWord Then
Set objDoc = objInsp.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
If objDoc.ProtectionType = WdProtectionType.wdAllowOnlyReading Then objDoc.UnProtect
' replace the With block with your code
With objSel
.WholeStory
' Formatting code goes here
'.Font.Color = wdColorBlue
.Font.Size = 12
'.Font.Bold = True
'.Font.Italic = True
'.Font.Name = "Arial"
End With
End If
End If
End If
objItem.Save
Set objItem = Nothing
Set objWord = Nothing
Set objSel = Nothing
Set objInsp = Nothing
End Sub