Results 1 to 10 of 10

Thread: Variable Indirection

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    I have re-read your original post and I still don't think I get it, but let's try to clarify.

    Are you saying that you have a global variable that holds a class instance, and you want to call a method within the currently refrenced class? If so, isn't it as simple

    [vba]
    Dim glb_oRiskCache As Object

    Set glb_oRiskCache = New Class1
    MsgBox glb_oRiskCache.MyMethod

    Set glb_oRiskCache = New Class2
    MsgBox glb_oRiskCache.MyMethod
    [/vba]
    as an example.

    Wherever you are identifying glb_oRiskCache (as a string presumably) you could create the class instance there and then.

    Another alternative is to create a collection class for the classses.
    Last edited by Bob Phillips; 02-28-2007 at 05:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •