getting trues from questionare to total (true = 1)

B

barb

I am trying to create a questionnaire form using true = 1 and false = 0. At
the end for a scoring prespective I need a a box to total the trues. How can
I do this?
 
C

Cindy M.

Hi =?Utf-8?B?YmFyYg==?=,
I am trying to create a questionnaire form using true = 1 and false = 0. At
the end for a scoring prespective I need a a box to total the trues. How can
I do this?
You need to provide a lot more information, such as where these 1 and 0 values
are being stored. What kind of "form". Which version of Word.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
B

barb

Cindy,

First of all thank you for responding. I am usinf word 2007 and I need to
right in vb an if statement indicating that if a true is checked add one and
if a false is checked do not add anything but zero, in a box that give the
total at the end.

I have from the developmeer tab selected tools and indicated that I was a
option box for a dot 1 for true and 1 for false.
If you need more information let me know you email and I will attach a copy
of the form and submit to you.
 
D

Doug Robbins - Word MVP

What type of controls have you put on the form? Legacy Forms? Active X? ?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

barb

Axtive X...

Doug Robbins - Word MVP said:
What type of controls have you put on the form? Legacy Forms? Active X? ?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cindy M.

Hi =?Utf-8?B?YmFyYg==?=,
First of all thank you for responding. I am usinf word 2007 and I need to
right in vb an if statement indicating that if a true is checked add one and
if a false is checked do not add anything but zero, in a box that give the
total at the end.

I have from the developmeer tab selected tools and indicated that I was a
option box for a dot 1 for true and 1 for false.
This last sentence isn't making any sense; I'm assuming you mean "0 for false"?

Here's a code sample that loops through all the InlineShapes in a document,
checks whether it's a MSForms control and, if it is, whether the name starts
with "opt". I don't think there's any way to determine whether an ActiveX
control is one kind or another, except through using a naming convention. If the
control meets all the criteria its value is checked and the running sum adjusted
accordingly:

Sub CalculateActiveXOptionButtons()
Dim lSum As Long
Dim doc As Word.Document
Dim shp As Word.InlineShape
Dim ctl As Variant 'MsForms.OptionButton

Set doc = ActiveDocument
For Each shp In doc.InlineShapes
If shp.Type = wdInlineShapeOLEControlObject Then
Set ctl = shp.OLEFormat.Object
If Left(ctl.Name, 3) = "Opt" Then
If ctl.Value <> 0 Then
lSum = lSum + 1
End If
End If
End If
Next
MsgBox "The sum of option buttons checked = " & CStr(lSum)
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top