Reputation: 15043
I want to do a CallByName for some Subs but I just can't get it to go.
Everything goes fine until execution reaches the CallByName
, then I have problems:
Me
, it complains about a compile errorfrmMyServer
, it says "object or method not supported"Question: How do I do this?
This is what I have :
in my 'modHandleData'
Private Sub HandleRequestScriptedNPC(...)
' ...
NPCMethod = "Scripted_Npc_" & NpcNum
CallByName Me, NPCMethod, VbMethod, NpcNum, Index
End Sub
in my 'modScriptedNPC'
Public Sub Scripted_Npc_9(ByVal NpcNum As Long, PlayerNum As Long)
SendOneOptionMsg PlayerNum, "NPC 9", "NPC 9 talks." & vbCrLf & "Then gives you a clue"
End Sub
Upvotes: 0
Views: 1685
Reputation: 545638
You’re calling the code in a module, so there is no Me
instance (that only exists in classes, including forms). My VB6 is a bit rusty, but I believe you cannot call methods in modules using CallByName
since you need an object.
Upvotes: 4