Problem passing value from Module

ruthers
01-19-2006, 04:37 AM
I have created a form which runs through files and checks whether they have certain information in them (a formchecker)

The form code is now growing out of control and I want to break it down and put them in functions in modules.

my code was working before I tried to do this but I cannot work out how to get the boolean response back into my form code.

Public Function isOptionExplicit(strLn As String) As Boolean
On Error GoTo ErrorHandler

If InStr(1, LCase$(strLn), "option explicit") > 0 Then
If Mid$(strLn, 1, 1) <> "'" Then 'check line isn't commented
If StrComp(Mid$(Replace(LCase$(strLn), Space(1), ""), 1, 14), "optionexplicit") = 0 Then
isOptionExplicit = True
Else
End If
End If


Exit Function

ErrorHandler:
MsgBox "CheckOptionExplicit", Err.Number, Err.Description
End Function

'''''
Trying to get the code back into the form code

if check1(checkenum.checkoptionexplicit).value = vbchecked then
if IsOptionExplicit(strLn) = true then 'This is where I want the boolean True or false to be brought back in
end if

But it is saying (strln) variable not defined....
What am I doing wrong

MilanJ
01-19-2006, 04:52 AM
...
Trying to get the code back into the form code

if check1(checkenum.checkoptionexplicit).value = vbchecked then
if IsOptionExplicit(strLn) = true then 'This is where I want the boolean True or false to be brought back in
end if

But it is saying (strln) variable not defined....
What am I doing wrong

Did you declared variable strLn in calling procedure?

ruthers
01-19-2006, 05:37 AM
No, so I have changed it to (Ln) which is the same as the calling procedure.

If Check1(CheckEnum.checkoptionexplicit).Value = vbChecked Then
isfound(CheckEnum.checkoptionexplicit) = isOptionExplicit(Ln)
If isfound(CheckEnum.checkoptionexplicit) = True Then
End If

End If

''
If this receives a True how can I stop the rest of the coding.

MilanJ
01-19-2006, 05:43 AM
If it receives True, then insert some commands in this IF statement:

If isfound(CheckEnum.checkoptionexplicit) = True Then

... what you want to do - I don't know. You can, for example, exit procedure (Exit Sub )

End If

ruthers
01-19-2006, 06:19 AM
Thanks , I knew it would be something simple.

ruthers
01-19-2006, 08:00 AM
I am still having trouble with this. I have put

If Check1(CheckEnum.checkoptionexplicit).Value = vbChecked Then
isfound(CheckEnum.checkoptionexplicit) = isOptionExplicit(ln)
If isfound(CheckEnum.checkoptionexplicit) = True Then
Exit Sub

End If
End If

But I am not wanting it to exit the sub, just stop this one check and go onto the next.

any ideas?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum