Activex objects referenced dynamically

  • Hello, I use a program to revive data from several COM ports into excel. I want to launch one program for each port and check for data for each. I wonder if I need to write a script for each port or if the program objects can be referenced dynamically like a dictionary.

    Here is the part of my code I'm having trouble with:

    [ufCODE]Dim COMS As Object
    Set COMS = CreateObject("Scripting.Dictionary")

    COMS(0) = CreateObject("Realterm.RealtermIntf")
    COMS(1) = CreateObject("Realterm.RealtermIntf")

    Dim i As Byte
    For i = 0 To 1
    ' check for data and do stuff here

    Here I get an error at COMS(0) = ....
    Is there a way?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!