• Status: Solved
• Priority: Medium
• Security: Public
• Views: 186

# Word 2003:How can I loop two integer variable to the sum of these two variable?

Is there a way to assign the value of an integer variable to another integer variable and then get the sum out of these two variables?  As in the follow do not added up right as desired in Word 2003:
varOne =0
varTwo=2
for i = 1 to 3
varOne=varOne+varTwo
next i
0
isischen
• 3
1 Solution

Commented:
I must be missing something ... it works as coded, did you want it do something, or more correctly what were you expecting?

Chris
0

Commented:
i.e. outputs are:
2, (varone = 0 + vartwo = 2)
4, (varone = 2 + vartwo = 2)
6, (varone = 4 + vartwo = 2)

Chris
0

Author Commented:
actually the calculation is not done in a For...Next loop.  I declared variables as arguments in the Function syntax and set variable to 0s and set up varOne=varOne+varTwo equation as statement.
I want to pass the value of varOne to a second function for other calculation.  varTwo is a return from a method in the first function which is to be reused after looping thru procedures. I was hoping  varOne would be incremented.
0

Commented:
Then I suspect it is how the data is passed to the routine making the change.

If a value is passed by value it can be accessed in the called routine but the original value is unchanged.  When passing the varone parameter try using the byref keyword i.e. sub2(byref varone as integer)

Chris
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.