To send a message within an internal transaction, the MSMQTransactionDispenser is used to create the transaction object. After the transaction object is created, make sure it is referenced in the call to Send.
Dim xdispenser as New MSMQTransactionDispenser
Set xact = xdispenser.BeginTransaction
Set qSend = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
msg.Label = "MyTransaction message" msg.Body = "Message 1 Body" msg.Send qSend, xact 'Associates send with xact.
This example sends a single message within an internal transaction.
Dim xdispenser as New MSMQTransactionDispenser Dim xact as MSMQTransaction Dim qSend as MSMQQueue Dim msg as New MSMQMessage Set xact = xdispenser.BeginTransaction 'Assumes queue already exists and is transactional. Set qSend = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE) msg.Label = "MyTransaction message" msg.Body = "Message 1 Body" msg.Send qSend, xact 'Associates send with xact.