Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: deiutza20 21 ani
| Femeie 21 ani Bacau cauta Barbat 21 - 44 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 739
|
|
Source:
Code:
Public Sub Black_Text_Selection()
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
With objSel
' Formatting code goes here
.Font.Color = RGB(0, 0, 0)
End With
End If
End If
End If
Set objItem = Nothing
Set objWord = Nothing
Set objSel = Nothing
Set objInsp = Nothing
End Sub |
|
|
pus acum 1 an |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 739
|
|
Simpler approach:
Sub Black()
Dim objDoc As Word.Document Dim objSel As Word.Selection On Error Resume Next
' get a Word.Selection from the open Outlook item Set objDoc = Application.ActiveInspector.WordEditor Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection objSel.Font.ColorIndex = wdBlack
Set objDoc = Nothing Set objSel = Nothing
End Sub |
If black - blue, if blue - black:
Sub Blue()
Dim objDoc As Word.Document Dim objSel As Word.Selection On Error Resume Next
' get a Word.Selection from the open Outlook item Set objDoc = Application.ActiveInspector.WordEditor Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection If objSel.Font.ColorIndex = wdBlue Then objSel.Font.ColorIndex = wdBlack Else objSel.Font.ColorIndex = wdBlue End If
Set objDoc = Nothing Set objSel = Nothing
End Sub |
|
|
pus acum 1 an |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 739
|
|
If you want to strikethrough the text use the following:
Sub Strike()
Dim objDoc As Word.Document Dim objSel As Word.Selection On Error Resume Next
' get a Word.Selection from the open Outlook item Set objDoc = Application.ActiveInspector.WordEditor Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection objSel.Font.Strikethrough = wdToggle
Set objDoc = Nothing Set objSel = Nothing
End Sub |
|
|
pus acum 1 an |
|