Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to take the selected values in the l_freq and u_freq, and use them to create a string that will be used as select criteria for another field in the document. The code I have so far (to build the string, and put the string in a variable) doesn't seem to work.
sub SetLimits()
end sub
When the code gets to the last line, I get an error that says: "Object Required: 'SelectString'
What am I doing wrong?
Oh, and yes, I realize that I can do this in an action, but I ran into problems with things not happening sequentially, so variables were not getting set properly.
Thanks!
dim SelectString
SelectString = ""
ActiveDocument.Fields("l_freq").SelectPossible
ActiveDocument.Fields("u_freq").SelectPossible
set LB = ActiveDocument.getField("l_freq").getSelectedValues()
set UB = ActiveDocument.getField("u_freq").getSelectedValues()
for i = 0 to LB.Count-1
if i = 0 then SelectString = "("
SelectString = SelectString & ">=" & LB.item(i).text & "<=" & UB.item(i).text
if i = LB.Count-1 then
SelectString = SelectString & ")"
else
SelectString = SelectString & "|"
end if
next
ActiveDocument.Variables("Variable1").setContent SelectString.GetContent.string, true
at the last line you don't need the .getcontent.string
ActiveDocument.Variables("Variable1").setContent SelectString, true
I guess this is because this variable (SelectString) was only exists in this macro environment.
The other case you were working with an object associated with a document variable.
Hope it helps,
Erich
at the last line you don't need the .getcontent.string
ActiveDocument.Variables("Variable1").setContent SelectString, true
I guess this is because this variable (SelectString) was only exists in this macro environment.
The other case you were working with an object associated with a document variable.
Hope it helps,
Erich
Yep, very much so! Thanks!