Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

Making a data string object for VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
red6000 - 04 Oct 2005 12:21 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.