P
Prabuddha Gupta
I am trying to communicate between java and Excel. in Excel, How and
where should I put my Winsock code so that once excel is up..java
client can communicate. I wrote the following code in a VB form
mudule..it worked fine, but when I copied it in excel userform...its
events are not being fired. it starts fine and and is in listening
mode...java socket send the data fine (doesn't complain about
connection), but dataArrival event is not fired..what could be the
reason..I tried declaring with withevents too.
Thanks for any help..
Prabuddha
*********************************Code*************************
Private Winsock1 As New Winsock
Private Sub cmdSend_Click()
' send data from the excel
Winsock1.SendData "hi from Excel" & vbCrLf
DoEvents
End Sub
Public Sub Main()
' set up the socket to listen on port 10101
Winsock1.LocalPort = 10101
Winsock1.Listen
DoEvents
End Sub
Public Sub Winsock_ConnectionRequest(ByVal RequestID As Long)
' reset the socket, and accept the new connection
Winsock1.Close
Winsock1.Accept RequestID
End Sub
Public Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
MsgBox strData
End Sub
where should I put my Winsock code so that once excel is up..java
client can communicate. I wrote the following code in a VB form
mudule..it worked fine, but when I copied it in excel userform...its
events are not being fired. it starts fine and and is in listening
mode...java socket send the data fine (doesn't complain about
connection), but dataArrival event is not fired..what could be the
reason..I tried declaring with withevents too.
Thanks for any help..
Prabuddha
*********************************Code*************************
Private Winsock1 As New Winsock
Private Sub cmdSend_Click()
' send data from the excel
Winsock1.SendData "hi from Excel" & vbCrLf
DoEvents
End Sub
Public Sub Main()
' set up the socket to listen on port 10101
Winsock1.LocalPort = 10101
Winsock1.Listen
DoEvents
End Sub
Public Sub Winsock_ConnectionRequest(ByVal RequestID As Long)
' reset the socket, and accept the new connection
Winsock1.Close
Winsock1.Accept RequestID
End Sub
Public Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
MsgBox strData
End Sub