Random letter colors?

L

LurfysMa

Is there any way to get Word to change each letter in a selection of
text to a random color? I am writing some Santa letters to some kids
in a playful font and I would like to print them in color.

I guess I could write a little macro.
 
J

Jay Freedman

Is there any way to get Word to change each letter in a selection of
text to a random color? I am writing some Santa letters to some kids
in a playful font and I would like to print them in color.

I guess I could write a little macro.

You could write a little macro, but you might find a little wrinkle
that needs to be worked out. Yellow and white characters don't print
very well. <g> Try this:

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex

Randomize
For Each oCh In ActiveDocument.Characters
Do ' get a random color that isn't white or yellow
myColor = 14 * Rnd() + 1
Loop Until (myColor <> wdWhite) And (myColor <> wdYellow)

oCh.Font.ColorIndex = myColor
Next oCh
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
L

LurfysMa

You could write a little macro, but you might find a little wrinkle
that needs to be worked out. Yellow and white characters don't print
very well. <g> Try this:

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex

Randomize
For Each oCh In ActiveDocument.Characters
Do ' get a random color that isn't white or yellow
myColor = 14 * Rnd() + 1
Loop Until (myColor <> wdWhite) And (myColor <> wdYellow)

oCh.Font.ColorIndex = myColor
Next oCh
End Sub

Wow. That is slick. I had a much more complicated macro going.

Can I ask you to tweak it so that it

(a) Only works on the currently selected text, and
(b) Only uses a predefined list of colors (red, green, blue, for
example)?

Thanks
 
K

Klaus Linke

Hi LurfysMa,
Can I ask you to tweak it so that it
(a) Only works on the currently selected text, and

Easy: change ActiveDocument to Selection.
(b) Only uses a predefined list of colors (red, green, blue, for
example)?

One possibility is a Select Case, but for the heck of it, I used Switch:

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex

Randomize
For Each oCh In Selection.Characters

myColor = Int(3 * Rnd())

oCh.Font.ColorIndex = _
Switch(myColor = 0, wdBlue, _
myColor = 1, wdRed, _
myColor = 2, wdGreen)

Next oCh
End Sub

Regards,
Klaus
 
G

Graham Mayor

Another possibility is the inverse of Jay's code

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex
Randomize
For Each oCh In Selection.Characters
Do
myColor = 14 * Rnd() + 1
Loop Until (myColor = wdBlue) Or (myColor = wdRed) Or (myColor =
wdGreen)
oCh.Font.ColorIndex = myColor
Next oCh
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
L

LurfysMa

Another possibility is the inverse of Jay's code

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex
Randomize
For Each oCh In Selection.Characters
Do
myColor = 14 * Rnd() + 1
Loop Until (myColor = wdBlue) Or (myColor = wdRed) Or (myColor =
wdGreen)
oCh.Font.ColorIndex = myColor
Next oCh
End Sub

I was thinking of defining an array to hold the desired list of
colors. I'll have to figure out what the numbers are for red and green
(for Christmas letters). Then I could either select them randomly or
cycle through them.

I'll play with these variations.

Thanks
 
J

Jay Freedman

I was thinking of defining an array to hold the desired list of
colors. I'll have to figure out what the numbers are for red and green
(for Christmas letters). Then I could either select them randomly or
cycle through them.

I'll play with these variations.

Thanks

To find the numbers, go into the VBA editor and press F2 to open the
Object Browser. Type wdColorIndex into the search box and press Enter.
Near the bottom right you'll see a list of "Members of wdColorIndex"
with the names. Click any color name and look at the bottom-most pane
to see its numeric value.

Another way is to open the Immediate window in the editor (shortcut is
Ctrl+G) and type a question mark followed by the color name. When you
press Enter, the value will be printed below (because the question
mark is shorthand for the Print command). For example,

?wdRed

displays the value 6.

Finally, you don't have to know the numbers at all. You can do
something like this:

Dim ColorArray(2) As WdColorIndex ' declares 3 elements 0,1,2
Dim myColor As WdColorIndex

ColorArray(0) = wdBlue
ColorArray(1) = wdRed
ColorArray(2) = wdGreen

and then in the For Each loop select one element from the array this
way:

myColor = ColorArray(Int(3 * Rnd()))

The 3 in this statement is the number of elements in the array -- it
could also be written as

myColor = ColorArray(Int((UBound(ColorArray) + 1) * Rnd()))

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
G

Graham Mayor

Am I missing something here - if the aim of this was as originally described
"I am writing some Santa letters to some kids
in a playful font and I would like to print them in color" then what's the
point of the extra sophistication? Any of the suggestions posted would do
the job. Macros are there to help you work, not to spend more time on them
than the original job they replace.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzanne S. Barnhill

I have been biting my tongue through this entire thread. I think the idea of
random colors for text (if by random we're talking about alternating between
letters) is a *terrible* idea that should have been nipped in the bud!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

JoAnn Paules [MVP]

I think a lot depends on the target audience and the purpose of the
document. A letter from Santa would be one of the few instances when
something like this is acceptable. (To be honest - I can't really think of
another use but I don't usually produce documents where multi-colored fonts
would be appreciated. They just don't seem to have a place in a medical
practice.
 
P

Peter in New Zealand

Every year I send out a Christmas newsletter to quite a lot of children
(grownup now, and grand children. I have established this as a family
tradition over several years, and they all seem to enjoy their Christmas
letter from Grandad. I use Word to compose it, with text and pictures, and
it's always been a heap of fun. Each sub heading has always been prepared
with alternative red and green letters, and looks real great in that
context. It's just for the kids, and only once a year, but something to do
it automatically would be a great labour saver to say the least.
--
Peter in New Zealand. (Pull the plug out to reply.)
Collector of old cameras, tropical fish fancier, good coffee nutter, and
compulsive computer fiddler.

JoAnn Paules said:
I think a lot depends on the target audience and the purpose of the
document. A letter from Santa would be one of the few instances when
something like this is acceptable. (To be honest - I can't really think of
another use but I don't usually produce documents where multi-colored fonts
would be appreciated. They just don't seem to have a place in a medical
practice.

--

JoAnn Paules
MVP Microsoft [Publisher]



Suzanne S. Barnhill said:
I have been biting my tongue through this entire thread. I think the idea
of
random colors for text (if by random we're talking about alternating
between
letters) is a *terrible* idea that should have been nipped in the bud!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.
 
J

JoAnn Paules [MVP]

Why not create a template?

--

JoAnn Paules
MVP Microsoft [Publisher]



Peter in New Zealand said:
Every year I send out a Christmas newsletter to quite a lot of children
(grownup now, and grand children. I have established this as a family
tradition over several years, and they all seem to enjoy their Christmas
letter from Grandad. I use Word to compose it, with text and pictures, and
it's always been a heap of fun. Each sub heading has always been prepared
with alternative red and green letters, and looks real great in that
context. It's just for the kids, and only once a year, but something to do
it automatically would be a great labour saver to say the least.
--
Peter in New Zealand. (Pull the plug out to reply.)
Collector of old cameras, tropical fish fancier, good coffee nutter, and
compulsive computer fiddler.

JoAnn Paules said:
I think a lot depends on the target audience and the purpose of the
document. A letter from Santa would be one of the few instances when
something like this is acceptable. (To be honest - I can't really think
of
another use but I don't usually produce documents where multi-colored fonts
would be appreciated. They just don't seem to have a place in a medical
practice.

--

JoAnn Paules
MVP Microsoft [Publisher]



Suzanne S. Barnhill said:
I have been biting my tongue through this entire thread. I think the
idea
of
random colors for text (if by random we're talking about alternating
between
letters) is a *terrible* idea that should have been nipped in the bud!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.

Am I missing something here - if the aim of this was as originally
described
"I am writing some Santa letters to some kids
in a playful font and I would like to print them in color" then what's
the
point of the extra sophistication? Any of the suggestions posted would do
the job. Macros are there to help you work, not to spend more time on
them
than the original job they replace.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

LurfysMa wrote:
Another possibility is the inverse of Jay's code

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex
Randomize
For Each oCh In Selection.Characters
Do
myColor = 14 * Rnd() + 1
Loop Until (myColor = wdBlue) Or (myColor = wdRed) Or
(myColor = wdGreen)
oCh.Font.ColorIndex = myColor
Next oCh
End Sub

I was thinking of defining an array to hold the desired list of
colors. I'll have to figure out what the numbers are for red and green
(for Christmas letters). Then I could either select them randomly or
cycle through them.

I'll play with these variations.

Thanks
 
P

Peter in New Zealand

Ahem! Now, I must explain that I have been a user of Word ever since ver.
97, so why didn't I think of something so stupidly obvious? I am over 60,
and it is the end of the year, but (flushing bright pink and gazing at the
ceiling) I still can't understand it. Thank you for answering nicely and not
telling me how silly I am not to have thought of it myself.

Peter.

JoAnn Paules said:
Why not create a template?

--

JoAnn Paules
MVP Microsoft [Publisher]



Peter in New Zealand said:
Every year I send out a Christmas newsletter to quite a lot of children
(grownup now, and grand children. I have established this as a family
tradition over several years, and they all seem to enjoy their Christmas
letter from Grandad. I use Word to compose it, with text and pictures, and
it's always been a heap of fun. Each sub heading has always been prepared
with alternative red and green letters, and looks real great in that
context. It's just for the kids, and only once a year, but something to do
it automatically would be a great labour saver to say the least.
--
Peter in New Zealand. (Pull the plug out to reply.)
Collector of old cameras, tropical fish fancier, good coffee nutter, and
compulsive computer fiddler.

JoAnn Paules said:
I think a lot depends on the target audience and the purpose of the
document. A letter from Santa would be one of the few instances when
something like this is acceptable. (To be honest - I can't really think
of
another use but I don't usually produce documents where multi-colored fonts
would be appreciated. They just don't seem to have a place in a medical
practice.

--

JoAnn Paules
MVP Microsoft [Publisher]



I have been biting my tongue through this entire thread. I think the
idea
of
random colors for text (if by random we're talking about alternating
between
letters) is a *terrible* idea that should have been nipped in the bud!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.

Am I missing something here - if the aim of this was as originally
described
"I am writing some Santa letters to some kids
in a playful font and I would like to print them in color" then what's
the
point of the extra sophistication? Any of the suggestions posted
would
do
the job. Macros are there to help you work, not to spend more time on
them
than the original job they replace.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

LurfysMa wrote:
wrote:

Another possibility is the inverse of Jay's code

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex
Randomize
For Each oCh In Selection.Characters
Do
myColor = 14 * Rnd() + 1
Loop Until (myColor = wdBlue) Or (myColor = wdRed) Or
(myColor = wdGreen)
oCh.Font.ColorIndex = myColor
Next oCh
End Sub

I was thinking of defining an array to hold the desired list of
colors. I'll have to figure out what the numbers are for red and green
(for Christmas letters). Then I could either select them randomly or
cycle through them.

I'll play with these variations.

Thanks
 
J

JoAnn Paules [MVP]

We have all missed things that are so darned obvious to others that it's
laughable. I think I'm in the minority because I'll openly admit to doing
that. Either that or I'm looking for the most convoluted way to do something
and it's just a click away.

You know there are pretty cool things you could do with WordArt. And if
you'd ever try a program like Photoshop Elements, you'd be banging out some
spectacular letters. Could be a way to earn a little extra egg money.....

--

JoAnn Paules
MVP Microsoft [Publisher]



Peter in New Zealand said:
Ahem! Now, I must explain that I have been a user of Word ever since ver.
97, so why didn't I think of something so stupidly obvious? I am over 60,
and it is the end of the year, but (flushing bright pink and gazing at the
ceiling) I still can't understand it. Thank you for answering nicely and
not
telling me how silly I am not to have thought of it myself.

Peter.

JoAnn Paules said:
Why not create a template?

--

JoAnn Paules
MVP Microsoft [Publisher]



Peter in New Zealand said:
Every year I send out a Christmas newsletter to quite a lot of children
(grownup now, and grand children. I have established this as a family
tradition over several years, and they all seem to enjoy their
Christmas
letter from Grandad. I use Word to compose it, with text and pictures, and
it's always been a heap of fun. Each sub heading has always been prepared
with alternative red and green letters, and looks real great in that
context. It's just for the kids, and only once a year, but something to do
it automatically would be a great labour saver to say the least.
--
Peter in New Zealand. (Pull the plug out to reply.)
Collector of old cameras, tropical fish fancier, good coffee nutter,
and
compulsive computer fiddler.

I think a lot depends on the target audience and the purpose of the
document. A letter from Santa would be one of the few instances when
something like this is acceptable. (To be honest - I can't really
think
of
another use but I don't usually produce documents where multi-colored
fonts
would be appreciated. They just don't seem to have a place in a
medical
practice.

--

JoAnn Paules
MVP Microsoft [Publisher]



I have been biting my tongue through this entire thread. I think the
idea
of
random colors for text (if by random we're talking about alternating
between
letters) is a *terrible* idea that should have been nipped in the bud!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the
newsgroup
so
all may benefit.

Am I missing something here - if the aim of this was as originally
described
"I am writing some Santa letters to some kids
in a playful font and I would like to print them in color" then what's
the
point of the extra sophistication? Any of the suggestions posted would
do
the job. Macros are there to help you work, not to spend more time on
them
than the original job they replace.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

LurfysMa wrote:
wrote:

Another possibility is the inverse of Jay's code

Sub RandomColors()
Dim oCh As Range
Dim myColor As Word.WdColorIndex
Randomize
For Each oCh In Selection.Characters
Do
myColor = 14 * Rnd() + 1
Loop Until (myColor = wdBlue) Or (myColor = wdRed) Or
(myColor = wdGreen)
oCh.Font.ColorIndex = myColor
Next oCh
End Sub

I was thinking of defining an array to hold the desired list of
colors. I'll have to figure out what the numbers are for red and
green
(for Christmas letters). Then I could either select them randomly or
cycle through them.

I'll play with these variations.

Thanks
 
L

LurfysMa

To find the numbers, go into the VBA editor and press F2 to open the
Object Browser. Type wdColorIndex into the search box and press Enter.
Near the bottom right you'll see a list of "Members of wdColorIndex"
with the names. Click any color name and look at the bottom-most pane
to see its numeric value.

Another way is to open the Immediate window in the editor (shortcut is
Ctrl+G) and type a question mark followed by the color name. When you
press Enter, the value will be printed below (because the question
mark is shorthand for the Print command). For example,

?wdRed

displays the value 6.

Finally, you don't have to know the numbers at all. You can do
something like this:

Dim ColorArray(2) As WdColorIndex ' declares 3 elements 0,1,2
Dim myColor As WdColorIndex

ColorArray(0) = wdBlue
ColorArray(1) = wdRed
ColorArray(2) = wdGreen

and then in the For Each loop select one element from the array this
way:

myColor = ColorArray(Int(3 * Rnd()))

The 3 in this statement is the number of elements in the array -- it
could also be written as

myColor = ColorArray(Int((UBound(ColorArray) + 1) * Rnd()))

Jay,

Thanks for the help. I didn't get time to work on this before I needed
the letters done so I just did it by hand. Now I would like to finish
the macro for next year.

My latest version is show below. I have a few questions:


'===============================================
' Macro to set individual character colors
'===============================================
Sub RandCharColors()

Dim oChar As Range
Dim myColor As Word.WdColorIndex
Dim iColors(1) As WdColorIndex

iColors(0) = wdRed
iColors(1) = wdGreen

Randomize
For Each oChar In Selection.Characters
myColor = iColors(Int((UBound(iColors) + 1) * Rnd()))
oChar.Font.ColorIndex = myColor
Next oChar

End Sub


Is there some way to define the list of colors as a list, rather than
an array? I am trying to avoid the inconvenience of numbering the
array elements and declaring the array size. Maybe something like:

Colors = wdRed wdGreen wdBlue ...

I am looking for some construct that gets defined without any literals
and the code adapts accordingly.

Why "o" prefix or "oChar"?

What's recommended prefix for a color index variable?
 
L

LurfysMa

Am I missing something here - if the aim of this was as originally described
"I am writing some Santa letters to some kids
in a playful font and I would like to print them in color" then what's the
point of the extra sophistication? Any of the suggestions posted would do
the job. Macros are there to help you work, not to spend more time on them
than the original job they replace.

Actually, I think you are missing quite a lot.

Yes, I wanted the macro to save me the trouble of editing each
individual character. But I also wanted to learn something about how
Word macros and VBA work and have a little fun writing the code.
 
L

LurfysMa

I have been biting my tongue through this entire thread. I think the idea of
random colors for text (if by random we're talking about alternating between
letters) is a *terrible* idea that should have been nipped in the bud!

Oh, well, if you think it's a terrible idea, then I will stop it right
now. I wouldn't want to offend the fun police.

Unfortunately, it's too late for this year. I didn't get the macro
working in time so I had to do it by hand. But the kids thought it was
very cool. They probably need to be educated on what a terrible idea
it is. Would you like to come over and scold them? Maybe you would
like to rap my knuckles with a ruler.
 
L

LurfysMa

Every year I send out a Christmas newsletter to quite a lot of children
(grownup now, and grand children. I have established this as a family
tradition over several years, and they all seem to enjoy their Christmas
letter from Grandad. I use Word to compose it, with text and pictures, and
it's always been a heap of fun. Each sub heading has always been prepared
with alternative red and green letters, and looks real great in that
context. It's just for the kids, and only once a year, but something to do
it automatically would be a great labour saver to say the least.

I am going to see if I can learn enough VBA to get this macro working.
When I do, I'll post the result. The template solution will only work
if the text you use is the same every time.
 
J

Jay Freedman

Jay,

Thanks for the help. I didn't get time to work on this before I needed
the letters done so I just did it by hand. Now I would like to finish
the macro for next year.

My latest version is show below. I have a few questions:


'===============================================
' Macro to set individual character colors
'===============================================
Sub RandCharColors()

Dim oChar As Range
Dim myColor As Word.WdColorIndex
Dim iColors(1) As WdColorIndex

iColors(0) = wdRed
iColors(1) = wdGreen

Randomize
For Each oChar In Selection.Characters
myColor = iColors(Int((UBound(iColors) + 1) * Rnd()))
oChar.Font.ColorIndex = myColor
Next oChar

End Sub


Is there some way to define the list of colors as a list, rather than
an array? I am trying to avoid the inconvenience of numbering the
array elements and declaring the array size. Maybe something like:

Colors = wdRed wdGreen wdBlue ...

I am looking for some construct that gets defined without any literals
and the code adapts accordingly.

Yes, there is a way. First, change the declaration (the Dim statement)
for the array to

Dim iColors As Variant

"Variant" is a special data type that can contain almost any other
kind of variable. Specifically, it can also hold an array of values.
(There's a long discussion of this idea in the thread "Max/Min
Functions" in the microsoft.public.word.vba.general newsgroup, started
by Greg Maxey on 12/2/2005.) Then you can assign an array of values to
this variable this way:

iColors = Array(wdRed, wdGreen, wdBlue)

This replaces the lines

iColors(0) = wdRed
iColors(1) = wdGreen
iColors(2) = wdBlue

and you can simply add more values inside the parentheses, separated
by commas. Nothing else in the macro has to change.
Why "o" prefix or "oChar"?

That variable is declared as a Range object, and the "o" stands for
"object". There's no standard for these prefixes, though, and you're
free to use whatever system you like (or no system).
What's recommended prefix for a color index variable?

This is less clear, and less important, than the object prefix. I use
a prefix on an object variable to remind myself that a Set statement
is necessary to assign a value to it. I also like to use a "str"
prefix on string variables. For a numeric variable, you could use a
prefix of "i" for "index" or "n" for "number", but it doesn't have
much purpose.

The main thing is not to use the name of a built-in type or a property
of an object as the name of a variable, because that can be confusing.
So "iColors" or "myColor" is good because it's obviously different
from the .Color property of a Font object.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
L

LurfysMa

Yes, there is a way. First, change the declaration (the Dim statement)
for the array to

Dim iColors As Variant

"Variant" is a special data type that can contain almost any other
kind of variable. Specifically, it can also hold an array of values.
(There's a long discussion of this idea in the thread "Max/Min
Functions" in the microsoft.public.word.vba.general newsgroup, started
by Greg Maxey on 12/2/2005.) Then you can assign an array of values to
this variable this way:

iColors = Array(wdRed, wdGreen, wdBlue)

This replaces the lines

iColors(0) = wdRed
iColors(1) = wdGreen
iColors(2) = wdBlue

and you can simply add more values inside the parentheses, separated
by commas. Nothing else in the macro has to change.

Excellent! Thanks.

Here's my latest version. I have some questions at the end.

'======================= sample code =================
Sub RandCharColors()

Dim oChar As Range
Dim myColor As Word.WdColorIndex
Dim vaColors As Variant
Dim iChar As Integer
Dim sOption As String

'Define the colors to be used
vaColors = Array(wdRed, wdGreen, wdBlack)

'Find out if the user wants random or repeating colors
Const sPrompt As String = "Click on:" & vbCrLf & _
"Yes = random colors" & vbCrLf & _
"No = repeating colors"
Const sTitle As String = "Random Character Colors Macro"
sOption = MsgBox(sPrompt, vbYesNoCancel, sTitle)
If sOption <> vbYes And sOption <> vbNo Then 'If neither yes or no,
exit
Call MsgBox("No action taken", , sTitle)
Return
End If

'Apply the colors
iChar = 0
Randomize
For Each oChar In Selection.Characters
If oChar.Text = " " Or oChar.Text = vbCr Or oChar.Text = vbLf Then
myColor = vbBlack
ElseIf sOption = vbYes Then
myColor = vaColors(Int((UBound(vaColors) + 1) * Rnd()))
Else
myColor = vaColors(iChar Mod (UBound(vaColors) + 1))
iChar = iChar + 1
End If
oChar.Font.ColorIndex = myColor
Next oChar

End Sub
'===========================================

1. Is there some way to modify the MsgBox function so that it will put
up buttins with different labels? I would like "Random", "Repeating",
and "Cancel". If not, is there another function to accomplish that?

2. I am testing for certain characters, such as space, CR and LF, so I
can skip them. Otherwise, the repeating pattern gets off. I should
probably add others such as tab. Is there a good way to test the
current character against a list (without doing separate compares) or
is there a way to test if it is a printable character (a-z, 0-9, or
certain specials (!#$%...)?

3. What's the best way to call the macro other than assigning it to a
keyboard shortcut?

Thanks. This has been kinda fun.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top