You could use it to change the font colorindex.
CallByName CallByName(Selection, "Font", VbGet), "ColorIndex",
VbLet, 3
This will set the ColorIndex of the Font of the Selection to 3
(red).
The inner CallByName returns (VbGet) the "Font" object property
of Selection object to the outer CallByName, which sets (VbLet)
the "ColorIndex" property to 3 (red).
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
wrote in message
ups.com...
Thanks for your response. I don't quite understand it. Could
I use it
to change the colorindex to a different value or just to check
what the
current color index is?
Thanks,
Andrew
Chip Pearson wrote:
You can do a few things with CallByName. E.g,.
Debug.Print CallByName(CallByName(Selection, "Font", VbGet),
"ColorIndex", VbGet) = 4
You can nest CallByName's to get the property value you need.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Chip Pearson" wrote in message
...
I don't believe there is any way to do this.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
wrote in message
oups.com...
Hi,
Is there any way for me to evaluate a string variable as if
it
were
code. For example, say I have an input
string=".Font.ColorIndex = 4".
Is there anyway for me to get VBA to evaluate the
expression:
"Selection" & string
and have it run as if it were the command
"Selection.Font.ColorIndex =
4"?
Thanks,
Andrew