View Single Post
 
Old 12-30-2012, 09:55 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,602
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Jennifer,

wdOrange is a Long variable not a wdColorIndex:

Code:
Sub MyRandCharColors()
Dim oChr As Range
Dim sngRan As Single
Dim lngColorNext As Long
Dim wdOrange As Long
Dim varColors
wdOrange = 41215
varColors = Array(wdGreen, wdOrange, wdBlue)
Randomize
For Each oChr In Selection.Characters
  sngRan = Rnd()
  lngColorNext = varColors(Int((UBound(varColors) + 1) * sngRan))
  On Error Resume Next
  oChr.Font.ColorIndex = lngColorNext
  If Err.Number <> 0 Then
    oChr.Font.Color = lngColorNext
  End If
Next oChr
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote