Consulting

Results 1 to 3 of 3

Thread: Connecting to MQ Series Queue using EXCEL VBA

  1. #1
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    3
    Location

    Connecting to MQ Series Queue using EXCEL VBA

    Hi,

    I am trying to connect to MQ Series Queue using EXCEL VBA and using the below code which I found somewhere on the net. When I run it, I get a 'Active X component can't create object' error.

    [VBA]Dim Session As MQSession
    Dim QueueManager As MQQueueManager
    Dim Queue As MQQueue

    Set Session = New MQSession
    Set QueueManager = New MQQueueManager

    QueueManager.Name="QueueManagerName"
    QueueManager.Connect

    Set Queue = QueueManager.AccessQueue("QueueName", MQOO_OUTPUT)
    [/VBA]
    while running this code, when it gets to Set Session = New MQSession, i get the 'Active X component can't create object' error.

    I have created a reference to MQAX200.dll to use the MQ. My requirement is to push some stuff onto the queue.

    Any help would be appreciated.

    Thank you.

    Rgds,
    Sai

  2. #2

    Just a Guess...

    Good Evening.

    This is just a guess, so don't be too harsh when it doesn't work...

    From a general program hierarchy, I would assume that the structure would be:

    MQQueManager
    ..|
    ..|_ MQSession
    ......|
    ......|_MQQueue

    From this philosophy, I would guess that you aren't wanting to create a New MQSession. Instead, you are probably wanting to do something like:

    [vba]
    Set Session = QueueManager.Sessions.Add

    ' OR

    Set Session = QueueManager.Sessions("SessionName")
    [/vba]

    I would look through the Object Browser and set the "Library" to MXAX200 or whatever it's called. Look for a Session Property or an AddSession Function.

    Hope this helps.
    Scott
    You don't understand anything until you learn it more than one way. ~Marvin Minsky

    I never teach my pupils; I only attempt to provide the conditions in which they can learn. - Albert Einstein

  3. #3
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    3
    Location
    Hi Scott,

    I have tried this but it does not work...I get a message saying 'Object variable or with block variable not set'.

    Rgds,
    Sai

Posting Permissions

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