View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default Control program flow

You did not understand my response. Try leaving the flow in one place , the
decisions in another, and the
actions in yet another. You have "If Param1" in both procedures and "Hilite"
in the same two.



"Dave Unger" wrote in message
...
Hello Harald,

Thanks for your reply. Your example using the Select Case method
(with which I’m very familiar) will work quite well in the simple
scenario you provided, where the query resides in 1 procedure, but
will not work in the more complicated situation I’m dealing with.

I re-worked my samples, hopefully will better illustrate what I’m
referring to.

Sub Main()
----Code here to retrieve parameters from table (Param1, Param2,
etc)
Call AnswerQuestion
If Param1 = "B" Then Hilite all incorrect answers in red ’provide
feedback to user after completion
End Sub

Sub AnswerQuestion ()
For x = 1 To 5
----Code here to display question(x)---
----Code here to evaluate answer to question(x)---
If Param1 = "A" AND answer(x) is incorrect then Hilite
answer(x) in red ’provide immediate feedback to user
Next x
End Sub

As I already said, no problem using If/Then in the above sample, but
when dealing with 40+ parameters, maintenance can become difficult
(but maybe there is no alternative). I was thinking along the lines
of programmatically building a class object at the start of the
application, it’s structure would be defined by the parameters. Then
the If/Then statements would no longer be required.

Regards,

Dave U