Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop VB statement

Status
Not open for further replies.

remeng

Technical User
Jul 27, 2006
523
US
Hi all,

I have a form in MS Project 2010 that I am trying to create. I am thinking the Loop statement might be the way to go for this, but I'm not sure since I haven't used VB in a while. Here is the scenario; I want to have a series of check boxes that will allow the user to select different tests to perform. I already have created a single check box scenario that works, but I don't know if there is a better way to go through 20 different check boxes since I don't want to repeat common code (checking status of the next box). I want to see if it the check box is either True or False and to take a similar action to the ElseIf statement then go to the next check box status.

Example:

[ ] Test 1
[x] Test 2
[x] Test 3
[ ] Test 4

returns to MS Project:

Test 2 is added to the time line.
Test 3 is added to the time line.

Test 1 is ignored.
Test 4 is ignored.


Code:
Private Sub CommandButton1_Click()

Dim ckeck
Dim bob
Dim test_identifier

check = CheckBox1


If check = False Then

bob = test_identifier_value

    SelectTaskField Row:=0, Column:="Name"
        SetTaskField Field:="Name", Value:=bob
        SelectTaskField Row:=1, Column:="Name"
        OutlineIndent

ElseIf CheckBox1.Value = True Then

bob = "test identifier"

    SelectTaskField Row:=0, Column:="Name"
        SetTaskField Field:="Name", Value:=bob
        SelectTaskField Row:=1, Column:="Name"
        OutlineIndent

End If

End Sub

Thank you,

Mike
 
This is not a .NET application. It is VBA.

forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top