PDA

View Full Version : Connecting to MQ Series Queue using EXCEL VBA



bvsn99
10-30-2008, 04:13 AM
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.

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)

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

Demosthine
10-30-2008, 06:16 PM
Good Evening.

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

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:


Set Session = QueueManager.Sessions.Add

' OR

Set Session = QueueManager.Sessions("SessionName")


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

bvsn99
10-31-2008, 09:45 AM
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