Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
I am trying to compare fV.GetContent.String to "Individual VaR" in VBA script but didn't get the syntax correctly, can anyone advice?
Sub SelectExp
 SET f = ActiveDocument.Fields("_dimension2")
 SET fV = f.GetSelectedValues
 
 If (fV.GetContent.String = "Individual VaR") Then
  ActiveDocument.Fields("Exposure Type").Select "INDIVIDUAL VAR"
 END If
End Sub
 
					
				
		
 m_woolf
		
			m_woolf
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Since the "_dimension2" field can have more than 1 selected value, you need to loop through them looking for the string - something like:
set val=ActiveDocument.Fields("_dimension2").GetSelectedValues
for i=0 to val.Count-1
if val.Item(i).Text) = "Individual VaR") Then
ActiveDocument.Fields("Exposure Type").Select "INDIVIDUAL VAR"
end if
next
 
					
				
		
 m_woolf
		
			m_woolf
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Since the "_dimension2" field can have more than 1 selected value, you need to loop through them looking for the string - something like:
set val=ActiveDocument.Fields("_dimension2").GetSelectedValues
for i=0 to val.Count-1
if val.Item(i).Text) = "Individual VaR") Then
ActiveDocument.Fields("Exposure Type").Select "INDIVIDUAL VAR"
end if
next
