However this code below runs well, but it did not create the two file names and categorize them.
Can anyone help me find a way to fix this?
Do I need two returning parameters for each routine (one each)?
Code: Select all
Sub CatagorizeNamesByGender()
Dim Jp As Long
Dim strZ(3), StaticArr(3) As String
Open "C:\Users\John\Documents\List of Names.txt" For Input As #100
For Jp = 0 To 3
Line Input #100, strZ(Jp)
Next Jp
For Jp = 0 To 3
If strZ(Jp) = "Male" Then
OutputMaleNames StAddX:=StaticArr
End If
If strZ(Jp) = "Female" Then
OutputFemaleNames StArr:=StaticArr
End If
Next Jp
End Sub
Sub OutputFemaleNames(ByRef StArr() As String)
Dim Hp As Long
Open "C:\Users\John\Documents\Female Names.txt" For Output As #101
For Hp = LBound(Hp) To UBound(Hp)
If InStr(1, StArr(Hp), "Female", vbTextCompare) > 0 Then
Write #101, StArr(Hp)
End If
Next Hp
Close #101
End Sub
Sub OutputMaleNames(ByRef StAddX() As String)
Dim Hp As Long
Open "C:\Users\John\Documents\Male Names.txt" For Output As #102
For Hp = LBound(Hp) To UBound(Hp)
If InStr(1, StAddX(Hp), "Male", vbTextCompare) > 0 Then
Write #102, StAddX(Hp)
End If
Next Hp
Close #102
JohnDBCTX