Pubic Sub Blah( Need Help here ?? ) [Resolved]
Ok here is my code.
[code
Public Sub NxAxMxE4( ????? )
Dim str As String
Dim x As Integer
str = Mid(Word, 1, 1) & Base & Mid(Word, 2, 1) & Base & Mid(Word, 3, 1) & Base & Mid(Word, 4, 1)
If Len(str) <= 32 Then
lstGen.AddItem str
End If
End Sub
[/code]
Ok where Base is, that is going to be a letter or letters. I want to be able to call it using a different letter.
Call NxAxMxE4 (xx)
So then Base will equal xx
Call NxAxMxE4 (vv)
So then Base will equal vv
How i do this ??
Re: Pubic Sub Blah( Need Help here ?? )
like this:
VB Code:
Public Sub NxAxMxE4([b]ByVal Base As String[/b])
Dim str As String
Dim x As Integer
str = Mid(Word, 1, 1) & Base & Mid(Word, 2, 1) & Base & Mid(Word, 3, 1) & Base & Mid(Word, 4, 1)
If Len(str) <= 32 Then
lstGen.AddItem str
End If
End Sub
Re: Pubic Sub Blah( Need Help here ?? )
damn i was missing the ByVal bit of.
Re: Pubic Sub Blah( Need Help here ?? )
If you miss the ByVal off then it defaults to ByRef which still would have worked.
The reason I chose ByVal is because you are not modifying the contents of Base, only reading it.
Re: Pubic Sub Blah( Need Help here ?? )
doesn't seem to be working :(
Re: Pubic Sub Blah( Need Help here ?? )
What's not working?
How are you calling the sub and what are you passing to it?
Re: Pubic Sub Blah( Need Help here ?? )
Code:
Public Sub NxAxMxE4(ByVal Base As String)
Dim str As String
Dim x As Integer
str = Mid(Word, 1, 1) & Base & Mid(Word, 2, 1) & Base & Mid(Word, 3, 1) & Base & Mid(Word, 4, 1)
If Len(str) <= 32 Then
lstGen.AddItem str
End If
End Sub
Calling It With This.
Code:
Public Sub Generate()
For I = 0 To lstBase.ListCount - 1
Word = lstBase.List(I)
Call NxAxMxE4(xx)
Next I
End Sub
So If List(i) was Rick i shud get RxxIxxCxxK
Re: Pubic Sub Blah( Need Help here ?? )
you need to put quotes around the xx
ie:
Re: Pubic Sub Blah( Need Help here ?? )
SWeeeeeeeeeeeeeeeeeeeeeeet
Thanks Bro.