J
JJ
I have a huge vba project in word. I previously had a variable called
"ELet_Heading" in my .dot document. I renamed this to "ELet_RE" and
added a few more variables. When I run the macro its seems to remember
what the previous variables were called and do not count through all
variables although I use the following in VBA:
For Each avar In ActiveDocument.Variables
If avar.Name = "ELet_RE" Then num = avar.Index
Next avar
If num = 0 Then
ActiveDocument.Variables.Add Name:="ELet_RE",
Value:=TextBox2.value
Else
ActiveDocument.Variables(num).Value = Textbox2.value
End If
I do this for each and every variable but when I do the test counting
the variables it only has 10 variables instead of for instance 15
variables and looking at the avar.Name I see that it doesn't run
through all the variable names. Is there a way of clearing / deleting /
removing the variables attached to that template so that it can see the
new variables as well.
"ELet_Heading" in my .dot document. I renamed this to "ELet_RE" and
added a few more variables. When I run the macro its seems to remember
what the previous variables were called and do not count through all
variables although I use the following in VBA:
For Each avar In ActiveDocument.Variables
If avar.Name = "ELet_RE" Then num = avar.Index
Next avar
If num = 0 Then
ActiveDocument.Variables.Add Name:="ELet_RE",
Value:=TextBox2.value
Else
ActiveDocument.Variables(num).Value = Textbox2.value
End If
I do this for each and every variable but when I do the test counting
the variables it only has 10 variables instead of for instance 15
variables and looking at the avar.Name I see that it doesn't run
through all the variable names. Is there a way of clearing / deleting /
removing the variables attached to that template so that it can see the
new variables as well.