Results 1 to 7 of 7

Thread: [VBA-win7]

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Posts
    7

    [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:
    1. Public WithEvents Sock As MSWinsockLib.Winsock
    2. Private Sub CommandButton1_Click()
    3.     Call createServSocket(9000)
    4.     'lunch file
    5.     Shell ("C:\xxx")
    6. End Sub
    7.  
    8. Public Sub createServSocket(port As Integer)
    9.     Set Sock = New MSWinsockLib.Winsock
    10.     Sock.Protocol = sckTCPProtocol
    11.     Sock.LocalPort = port
    12.     Sock.Listen
    13. 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:
    1. 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

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [VBA-win7]

    Moved To Office Development

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Posts
    7

    Re: [VBA-win7]

    Quote Originally Posted by baja_yu View Post
    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

  5. #5
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526

    Re: [VBA-win7]


  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Posts
    7

    Re: [VBA-win7]

    Quote Originally Posted by jdc2000 View Post
    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

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
  •  



Click Here to Expand Forum to Full Width