referring to increasing VBA variable name in loop
- From: ucdcrush@xxxxxxxxx
- Date: Wed, 28 Nov 2007 12:22:27 -0800 (PST)
I am using VBA to put together some phrases to be spoken with the text
to speech feature in excel.
What I've got is a list of string variables,
Phrase1
Phrase2
Phrase3
....
Phrase30
which are set equal to different words or phrases such as
Phrase1 = "Hello"
I can hard-code a variable name into the speech code such as:
XL.Speech.Speak Phrase1
this will successfully speak the string assigned to Phrase1.
What Im having trouble with is referring to the Phrase1-30 variables
in a for loop, something like
for i = 1 to 30
xl.speech.speak phrase & i
next
This code doesn't produce any speech, I'm assuming because the
variable name isn't being passed as intended. How can I refer to
variables within a loop, when the loop # (i) is part of the variable
name?
Thanks.
.
- Follow-Ups:
- Re: referring to increasing VBA variable name in loop
- From: Rick Rothstein \(MVP - VB\)
- Re: referring to increasing VBA variable name in loop
- From: Dave Peterson
- RE: referring to increasing VBA variable name in loop
- From: sebastienm
- Re: referring to increasing VBA variable name in loop
- Prev by Date: Re: Running macros in Excel 2007
- Next by Date: RE: Hide/Show column at run-time
- Previous by thread: Pasting lists into Forms
- Next by thread: RE: referring to increasing VBA variable name in loop
- Index(es):
Relevant Pages
|
Loading