|
-
Jul 14th, 2010, 06:25 AM
#1
Thread Starter
New Member
[VBA-win7]
Hi all, I have a problem with VBA. I would be very grateful if someone could help me.
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:
vb 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
vb Code:
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.....
Last edited by Hack; Jul 14th, 2010 at 06:31 AM.
Reason: Added Highlight Tags
-
Jul 14th, 2010, 06:28 AM
#2
Re: [VBA-win7]
Welcome to the Forum!
You posted in the wrong section. This is for VB Classic, which is different from VBA. I'll notify mods to move the thread for you to the right section.
-
Jul 14th, 2010, 06:30 AM
#3
Re: [VBA-win7]
Moved To Office Development
-
Jul 14th, 2010, 07:21 AM
#4
Thread Starter
New Member
Re: [VBA-win7]
 Originally Posted by baja_yu
Welcome to the Forum!
You posted in the wrong section. This is for VB Classic, which is different from VBA. I'll notify mods to move the thread for you to the right section.
ops, I'm sorry 
thanks
-
Jul 14th, 2010, 09:02 AM
#5
-
Jul 14th, 2010, 09:40 AM
#6
Thread Starter
New Member
Re: [VBA-win7]
 Originally Posted by jdc2000
thanks, but it is not a problem of automation. The automation itself it's ok.
It's a problem regarding the creation of the object Sock from MSwinsckLib.winsock....
So far I can't understand
-
Jul 15th, 2010, 06:14 AM
#7
Re: [VBA-win7]
you would need to register the ocx as administrator
most problems are to do with limited user accounts and incorrect installations
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|