Hi, I have a problem with VBA.
Let me explain it:
- I have written a simple Macro in Excel 2003 which is able to open Matlab and communicate with it by means of a socket. Here is the relevant part of the code:
Public WithEvents Sock As MSWinsockLib.Winsock
Private Sub CommandButton1_Click()
Call createServSocket(9000)
'lunch file
Shell ("C:\xxx")
End Sub
Public Sub createServSocket(port As Integer)
Set Sock = New MSWinsockLib.Winsock
Sock.Protocol = sckTCPProtocol
Sock.LocalPort = port
Sock.Listen
End Sub
IT WORKS using Excel 2003, Matlab R2007b and WINDOWS XP
the same code with the same version of Excel and Matlab but with WINDOWS 7 doesn't work! It gives me a runtime error 429. ActiveX can't create the object on this line
Set Sock = New MSWinsockLib.Winsock
I tried to:
- add MSWINSCK.OCX and register it
- add dao360.dll and register it
- add reference to Microsoft Winsock Control 6.0
- add reference to DAO library
but I couldn't find out why it doesn't work!
Do you have any idea?
please, help me.....
PS: anche in italiano la risposta va bene.
grazie