Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 12-30-2012, 09:33 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Is there no wdOrange colorindex variable? Windows XP Is there no wdOrange colorindex variable? Office 2007
Competent Performer
Is there no wdOrange colorindex variable?
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

Paul,

Thanks for the suggestion, but I can't get it to work.

Here's my little macro:
Code:
Sub MyRandCharColors()
 
Dim obChar As Range
Dim ilColorNext As Word.WdColorIndex
Dim wdOrange As Long
wdOrange = 41215
Dim vaColors
vaColors = Array(wdBlack, wdRed, wdBlue)
'vaColors = Array(wdBlack, wdOrange)
Dim nsRnd As Single
 
Randomize
For Each obChar In Selection.Characters
  nsRnd = Rnd()
  ilColorNext = vaColors(Int((UBound(vaColors) + 1) * nsRnd))
  obChar.Font.ColorIndex = ilColorNext
Next obChar
 
End Sub
As shown above, it works with the built-in colors. If I remove the comment from the second vaColors statement, it gets Run-time error "5843" indicating that one of the values is out of range.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there no wdOrange colorindex variable? Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM
Is there no wdOrange colorindex variable? variable Page references scrinmemphis Word 4 06-06-2012 11:50 PM
Is there no wdOrange colorindex variable? Capture a Font in a Variable joatmon Excel Programming 1 05-30-2012 08:23 PM
Help with VBA macro - Variable input sc30317 Excel Programming 0 08-31-2011 01:00 PM
Variable fields? Emalee77 PowerPoint 0 01-30-2011 05:58 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft