尝试
strInput = "<select name=""winner"">"
strInput = strInput & "<option></option>"
strInput = strInput & "<option value=""1"""
If intVal = 1 Then
strInput = strInput & " selected"
End If
strInput = strInput & ">1st</option>"
strInput = strInput & "<option value=""2"""
If intVal = 2 Then
strInput = strInput & " selected"
End If
strInput = strInput & ">2st</option>"
strInput = strInput & "<option value=""3"""
If intVal = 3 Then
strInput = strInput & " selected"
End If
strInput = strInput & ">3st</option>"
strInput = strInput & "<option value=""4"""
If intVal = 4 Then
strInput = strInput & " selected"
End If
strInput = strInput & ">4st</option>"
strInput = strInput & "</select>"
或者
Function IsSelected(optionValue, defaultValue)
If optionValue = defaultValue Then
IsSelected = " selected"
Else
IsSelected = ""
End If
End Function
strInput = "<select name=""winner"">" &_
"<option></option>" &_
"<option value=""1""" & IsSelected(1,intVal) & ">1st</option>" &_
"<option value=""2""" & IsSelected(2,intVal) & ">2nd</option>" &_
"<option value=""3""" & IsSelected(3,intVal) & ">3rd</option>" &_
"<option value=""4""" & IsSelected(4,intVal) & ">4th</option>" &_
"</select>"