Hi,
I have an item of data that I want to evaluate whether it is true or false
and then process, but I'm having a problem... at the moment I have:
Private Sub CommandButton2_Click()
Dim UFno As Integer
Dim Item1 As String
Dim OBno As Integer
UFno = 21
OBno = 1
Item1 = "UserForm" & UFno & "." & "OptionButton" & OBno
If Item1 = True Then
Selection.TypeText Text:=Item1
End If
End Sub
When I run the code I get an item mismatch and it highlights the line 'If
Item1 = True Then'.
Can anyone help?
Thanks.
Helmut Weber - 04 Oct 2005 14:01 GMT
Hi,
hm...
never heard of a data string object.
I think you want to know, whether item1 is empty.
if item1 = "" then
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Jonathan West - 04 Oct 2005 18:09 GMT
Hi red,
Try this
Dim UF As Object
Dim Item1 As Control
Dim UFno As Integer
Dim OBno As Integer
UFno = 21
OBno = 1
For Each UF In UserForms
If UF.name = "UserForm" & UFno Then
Set Item1 = UF.Controls("OptionButton" & OBno)
If Item1.Value Then
Selection.TypeText Text:=Item1.name
End If
End If
Next UF

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> Hi,
> I have an item of data that I want to evaluate whether it is true or false
[quoted text clipped - 28 lines]
>
> Thanks.