VB newbie - exposing VB subs to VBA?

From: Maury Markowitz (MauryMarkowitz_at_discussions.microsoft.com)
Date: 02/11/05

  • Next message: Sam Hobbs: "Re: COM Interface Security"
    Date: Fri, 11 Feb 2005 07:53:01 -0800
    
    

    I've programmed for some time using VBA, and I have written some code that
    works well when run on a particular machine -- it's hardware keyed. I would
    like to call that function remotely from Access however.

    I tried this using DCOM between the machines, but this has proven to be a
    real problem. Debugging is basically impossible, as far as I can tell, and
    any problem generally turns into a totally generic message, or both ends
    stalling. I have the _feeling_ that the problems are due to version
    differences of the apps on the two machines, and also that the programs are
    popping up invisible dialog boxes that can't be answered (for instance, it
    seems that Excel will ask you if you want to run macros).

    The code in question is very generic, so I'm thinking of simply putting it
    into VB and thereby avoiding these problems. So, my questions:

    How do I expose VB subs via COM? Is this automatic? If not, is it easy? I
    understand there's typically a registration process, but does VB do this
    automatically?

    Once exposed, what is the syntax for calling them? For instance in Excel I
    would do something like:

    xl = CreateObject("Excel.Application", "targetmachine")
    xl.Worksheets.Open("thesheet")
    xl.Run("theMacro")

    Alternate solution?

    There's only two parameters needed for this function, they could be passed
    in on the command line easily enough. This being the case, is there some easy
    way to fire up a command line app from a remote machine? This way I could
    avoid all of the DCOM issues entirely.


  • Next message: Sam Hobbs: "Re: COM Interface Security"
    Loading