Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

Easier way to populate an array

$
0
0
I have a little Word macro that will assign random colors to the selected text string. I use it to get multi-colored text for Christmas cards, etc.

It operates on an array of color values:

Code:

Dim Colors
Colors = Array(wdRed, wdRed, wdRed, wdGreen, wdGreen, wdBrightGreen)

Is there a way to populate this array where I can specify the number of copies of each color explicitly, rather than repeating the element multiple times?

I am hoping for something simple like:

Code:

Colors = Array(wdRed(3), wdGreen(2), wdBrightGreen(1))
Thanks

Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>