If then Loop

If then Loop

Anonymous
Not applicable
534 Views
3 Replies
Message 1 of 4

If then Loop

Anonymous
Not applicable
Please exscuse my level of programming... I have a routine which manipulates the attributes in a block, what I would like to know is if there is another way to include multiple attribute tags other than an If-Then Statement for each attribute. i.e. instead of this: If AttArray(I).TagString = "TITLE2" Then AttArray(I).TextString = "INTERCONNECTING DIAGRAM" End If If AttArray(I).TagString = "TITLE3" Then AttArray(I).TextString = "INTERCONNECTING DIAGRAM" End If Is there anyway to include title2 and title3 in one if then statement. Thanks
0 Likes
535 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Use SELECT CASE -- Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica (sorry, phony e-mail, SPAM made me do it) "Ryan Walker" wrote in message news:404cb910$1_3@newsprd01... > Please exscuse my level of programming... > > I have a routine which manipulates the attributes in a block, what I > would like to know is if there is another way to include multiple > attribute tags other than an If-Then Statement for each attribute. > > i.e. instead of this: > > If AttArray(I).TagString = "TITLE2" Then > AttArray(I).TextString = "INTERCONNECTING DIAGRAM" > End If > > If AttArray(I).TagString = "TITLE3" Then > AttArray(I).TextString = "INTERCONNECTING DIAGRAM" > End If > > Is there anyway to include title2 and title3 in one if then statement. > > Thanks >
0 Likes
Message 3 of 4

Anonymous
Not applicable
Jorge's suggestion is better in your case, but you could also do this If AttArray(I).TagString = "TITLE2" Then AttArray(I).TextString = "INTERCONNECTING DIAGRAM" ElseIf AttArray(I).TagString = "TITLE3" Then AttArray(I).TextString = "INTERCONNECTING DIAGRAM" Else 'unknown tag string MsgBox "TagString " & AttArray(I).TagString & " not found." End If
0 Likes
Message 4 of 4

Anonymous
Not applicable
This is how I do it... Watch for word wrap 'get the attributes from the attribute block varAttributes = BlockArray(ItmCount).GetAttributes 'fill in the block attributes Dim strAttributes As String Dim i As Integer For i = LBound(varAttributes) To UBound(varAttributes) Select Case varAttributes(i).TagString Case "PART" varAttributes(i).TextString = UCase(Itm.Name) Case "PCMRK" varAttributes(i).TextString = Itm.PosNumber Case "LEN" varAttributes(i).TextString = Round(Itm.Length, 3) Case "QTY_LK" varAttributes(i).TextString = mPmQuantityCol.Item(Itm.PosNumber) Case "AROT" varAttributes(i).TextString = CutA Case "BROT" varAttributes(i).TextString = CutB Case "CKROT" varAttributes(i).TextString = CheckRot Case "DIMA" If NumDimensionedHoles > 0 Then varAttributes(i).TextString = Round(HoleDims(0), 2) Case "DIMB" If NumDimensionedHoles > 1 Then varAttributes(i).TextString = Round(HoleDims(1), 2) Case "DIMC" If NumDimensionedHoles > 2 Then varAttributes(i).TextString = Round(HoleDims(2), 2) Case "DIMD" If NumDimensionedHoles > 3 Then varAttributes(i).TextString = Round(HoleDims(3), 2) Case "DIME" If NumDimensionedHoles > 4 Then varAttributes(i).TextString = Round(HoleDims(4), 2) Case "DIMF" If NumDimensionedHoles > 5 Then varAttributes(i).TextString = Round(HoleDims(5), 2) Case "DIMG" If NumDimensionedHoles > 6 Then varAttributes(i).TextString = Round(HoleDims(6), 2) Case "DIMH" If NumDimensionedHoles > 7 Then varAttributes(i).TextString = Round(HoleDims(7), 2) Case "DIMJ" If NumDimensionedHoles > 8 Then varAttributes(i).TextString = Round(HoleDims(8), 2) Case "DIMK" If NumDimensionedHoles > 9 Then varAttributes(i).TextString = Round(HoleDims(9), 2) Case "DIML" If NumDimensionedHoles > 10 Then varAttributes(i).TextString = Round(HoleDims(10), 2) Case "DIMM" If NumDimensionedHoles > 11 Then varAttributes(i).TextString = Round(HoleDims(11), 2) Case "ATTACHMENT1" If Itm.Note1 <> "" Then varAttributes(i).TextString = Itm.Note1 End If Case "ATTACHMENT2" If Itm.Note2 <> "" Then varAttributes(i).TextString = Itm.Note2 End If End Select Next Ryan Walker wrote: > Please exscuse my level of programming... > > I have a routine which manipulates the attributes in a block, what I > would like to know is if there is another way to include multiple > attribute tags other than an If-Then Statement for each attribute. > > i.e. instead of this: > > If AttArray(I).TagString = "TITLE2" Then > AttArray(I).TextString = "INTERCONNECTING DIAGRAM" > End If > > If AttArray(I).TagString = "TITLE3" Then > AttArray(I).TextString = "INTERCONNECTING DIAGRAM" > End If > > Is there anyway to include title2 and title3 in one if then statement. > > Thanks
0 Likes