Looping Through TextBoxes - If it is Possible - How? 
Author Message
 Looping Through TextBoxes - If it is Possible - How?

Hi,

I collected all my data, now I want to put it into arrays to do computations
then put it in a document.
I can find the bookmark and put the value/text of array variables after the
bookmark using concatenation as follows:

BookMarkCount  = 1
Do until BookMarkCount = 10
BookMarkPosition = "Position" & BookMarkCount  'This becomes BookMark1,
BookMark2, etc.
ActiveDocument.Bookmarks(BookMarkPosition).Range.InsertAfter
Position(BookMarkCount, 0)
BookMarkCount  =  BookMarkCount + 1
Loop

I want to do a similar thing to put the string/value of the textbox into an
array using concatenation.

TextBoxCount  = 1
Do until TextBoxCount  = 10
TextBoxPosition = "Array" $ TextBoxCount
MyArray(TextBoxCount - 1, 0) = UserForm1.TextBoxPosition .Value
'Remembering first position of array is 0
' I would hope TextBoxPosition would evaluate to TextBox1; TextBox2 etc -
But Not  - Just an empty string no error
TextBoxCount  =  TextBoxCount  + 1
Loop

How can I (if possible) do the above.

Thanks,

Ghost



Mon, 19 Jan 2004 16:07:34 GMT  
 Looping Through TextBoxes - If it is Possible - How?
Corrected Error
Quote:
>-----Original Message-----
>Hi,

>I collected all my data, now I want to put it into arrays
to do computations
>then put it in a document.
>I can find the bookmark and put the value/text of array
variables after the
>bookmark using concatenation as follows:

 BookMarkCount  = 1
 Do until BookMarkCount = 10
 BookMarkName = "MyBookMark" & BookMarkCount
'This becomes MyBookMark1, MyBookMark2, etc.
 ActiveDocument.Bookmarks(BookMarkName).Range.InsertAfter
ArrayName(BookMarkCount-1, 0)
'Subtract one from BookMarkCOunt To get the corresponding
Array Element Since Arrays start at zero
' Which you could change to start at one but I didn't
 BookMarkCount  =  BookMarkCount + 1
 Loop

Quote:
>I want to do a similar thing to put the string/value of
the textbox into an
>array using concatenation.

TextBoxCount  = 1
Do until TextBoxCount  = 10
TextBoxPosition = "ArrayName" $ TextBoxCount
MyArray(TextBoxCount - 1, 0) =
UserForm1.TextBoxPosition .Value
'Remembering first position of array is 0
' I would hope TextBoxPosition would evaluate to TextBox1;
TextBox2 etc -
But Not  - Just an empty string no error
TextBoxCount  =  TextBoxCount  + 1
Loop
Quote:

>How can I (if possible) do the above.

>Thanks,

>Ghost



Mon, 19 Jan 2004 18:33:40 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Looping through TextBoxes possible?

2. Is this possible, or am I pushing it?

3. Is this possible, or am I pushing it?

4. Is this possible, or am I pushing it?

5. is this possible or am I dreaming

6. Possible Bug? Deleting using For Each Loop

7. Looping a macro - is it possible?

8. Looping a macro-is it possible?

9. Looping possible in macro's?

10. Enumerations ---> howto loop trough all possible values

11. Is app message loop interception possible in VB?

12. Is app message loop interception possible in VB?

 

 
Powered by phpBB® Forum Software