PSS ID Number: 175872
Article Last Modified on 8/28/1999
Private Sub Form_Load()
Dim myQueueInfo As New MSMQQueueInfo
Dim myMessage As New MSMQMessage
Dim myNewMessage As New MSMQMessage
Dim myQueue As MSMQQueue
Dim myWordApp As New Word.Application
Dim myWordDoc As Word.Document
Dim myObj As Object
' pass the pathname of the Word document, make sure the file exists
Set myWordDoc = myWordApp.Documents.Open("wordfile.Doc", False, True)
myQueueInfo.PathName = ".\PersistQ"
myQueueInfo.Label = "Test Queue"
myQueueInfo.Create
' Open for send
Set myQueue = myQueueInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
myMessage.Body = myWordDoc
myMessage.Label = "Message"
myMessage.Send myQueue
MsgBox "Word Doc is sent" ' can verify in Explorer
myQueue.Close
' Open for Receive
Set myQueue = myQueueInfo.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)
Set myNewMessage = myQueue.Receive(wantBody:=True, _
ReceiveTimeout:=1000)
Set myObj = myNewMessage.Body
If TypeOf myObj Is Word.Document Then
MsgBox "Word Doc!"
Else
MsgBox "?"
End If
myQueue.Close
End Sub
Keywords: kbhowto KB175872
Technology: kbAudDeveloper kbMSMQ100 kbMSMQSearch