![]() |
|
|
|
#1
|
|||
|
|||
|
I did add Dim objSel As Word.Selection. But this may still not be enough.
This link provides details. http://www.slipstick.com/developer/w...outlook-email/ Code:
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 ' <--- Do not use this unless you have a specific purpose
'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
' replace the With block with your code
With objSel
' Formatting code goes here
.Font.Color = wdColorBlue
.Font.Size = 18
.Font.Bold = True
.Font.Italic = True
.Font.Name = "Arial"
End With
End If
End If
End If
Set objItem = Nothing
Set objWord = Nothing
Set objSel = Nothing
Set objInsp = Nothing
End Sub
|
|
#2
|
|||
|
|||
|
Thank you again; I do appreciate your time and talent. I am entirely novice in VBA; I had no idea this would be so involved, since it is so easy in Word.
It appears to me from the new code you have provided, that instead of pasting unformatted to paste copied text to adopt the style of my recipient paragraph, I am applying a specific formatting that is inflexible. Is this a correct reading? If so, and since I can paste unformatted via the Ribbon, as in Word (in Outlook: Format text/Paste/Paste special/Unformatted text), is there not a way to trigger this same command in a macro? |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EXCEL macro problem please help! | ryguy551 | Excel Programming | 2 | 05-22-2014 03:58 PM |
| Problem with macro | MS baby | Excel Programming | 4 | 03-31-2014 02:47 PM |
Problem with macro
|
tmill29 | Excel Programming | 1 | 06-08-2013 09:59 AM |
Moving data macro problem
|
MattMurdock | Excel Programming | 1 | 07-20-2012 04:49 AM |
Another simple macro problem
|
Ulodesk | Word VBA | 1 | 06-08-2012 06:24 PM |