R
RalphInBoise
Hello to all,
I have vba code that works perfectly when I put it in the code handler
for a button. But how do I place that code into a procedure, and then
call that procedure?
For example...
I have a button event handler that I moved the code that worked there to
a class module named, "Class1". Now I want to call that procedure to do
the same thing as its code did when it was in the event handler for the
button. Now I call the method like this, however it does not work. How
do I get the compiler to use the module?
Private Sub Command0_Click()
UpdateThatThing(1, "hotstuff")
End Sub
Then in a module that I named "Class1"...
Public Sub UpdateThatThing(intRecNo As Integer, strStat As String)
'My code goes here, the same code that worked fine
'when used as a button event handler.
End Sub
TIA,
Ralph in Boise
I have vba code that works perfectly when I put it in the code handler
for a button. But how do I place that code into a procedure, and then
call that procedure?
For example...
I have a button event handler that I moved the code that worked there to
a class module named, "Class1". Now I want to call that procedure to do
the same thing as its code did when it was in the event handler for the
button. Now I call the method like this, however it does not work. How
do I get the compiler to use the module?
Private Sub Command0_Click()
UpdateThatThing(1, "hotstuff")
End Sub
Then in a module that I named "Class1"...
Public Sub UpdateThatThing(intRecNo As Integer, strStat As String)
'My code goes here, the same code that worked fine
'when used as a button event handler.
End Sub
TIA,
Ralph in Boise