Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

using winsock in VBA

sean_dsean_d Posts: 4Member
I have a VBA (not VB) project that requires a client/server piece. I know I need a winsock control, but my version of VBA (that comes with Arena Modeling and Simulation software) does not have that control.

I've read that in VB, one can go to the projects menu and select the control. However, VBA doesn't have a projects menu. So, how can I get the winsock control in VBA? If I install VB 6 (which does allow for the winsock control), will this enable my VBA to have access to it?

Thanks,

Sean

Comments

  • PavlinIIPavlinII Posts: 404Member
    : I have a VBA (not VB) project that requires a client/server piece. I know I need a winsock control, but my version of VBA (that comes with Arena Modeling and Simulation software) does not have that control.
    :
    : I've read that in VB, one can go to the projects menu and select the control. However, VBA doesn't have a projects menu. So, how can I get the winsock control in VBA? If I install VB 6 (which does allow for the winsock control), will this enable my VBA to have access to it?
    :
    : Thanks,
    :
    : Sean
    :
    Hi, let's go...
    You have to add winsock control to your project. Tools/References/..Browse
    and find your winsock OCX file (%SYSEM%MSWINSCK.OCX - by default) and add it to your project. Now, make your component like this:
    [code]Private myWinSock As Object

    Sub asdf()
    Set myWinSock = New MSWinsockLib.Winsock

    MsgBox myWinSock.LocalIP
    End Sub[/code]And myWinSock will behave like your Winsock1 control in VB6... You don't need this control visible on some form, do you? ;-)


    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


  • sean_dsean_d Posts: 4Member
    : : I have a VBA (not VB) project that requires a client/server piece. I know I need a winsock control, but my version of VBA (that comes with Arena Modeling and Simulation software) does not have that control.
    : :
    : : I've read that in VB, one can go to the projects menu and select the control. However, VBA doesn't have a projects menu. So, how can I get the winsock control in VBA? If I install VB 6 (which does allow for the winsock control), will this enable my VBA to have access to it?
    : :
    : : Thanks,
    : :
    : : Sean
    : :
    : Hi, let's go...
    : You have to add winsock control to your project. Tools/References/..Browse
    : and find your winsock OCX file (%SYSEM%MSWINSCK.OCX - by default) and add it to your project. Now, make your component like this:
    : [code]Private myWinSock As Object
    :
    : Sub asdf()
    : Set myWinSock = New MSWinsockLib.Winsock
    :
    : MsgBox myWinSock.LocalIP
    : End Sub[/code]And myWinSock will behave like your Winsock1 control in VB6... You don't need this control visible on some form, do you? ;-)
    :
    :
    : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    :
    : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    :
    :
    :
    Pavlin II,

    Thank you for your response. I tried something like this, but the winsock object never became initialized. I saw that while I was in debug mode, the line AFTER the one in which I set myWinsock showed that myWinsock was set to Nothing.

    So, I'm wondering... Is there still a licensing issue? In other literature, I've read the warning that in VBA the winsock control can't be used unless there is a design time license for it. The way to get this license is by installing VB6. My question for you is, Do you have VB6 installed?

  • PavlinIIPavlinII Posts: 404Member
    : : : I have a VBA (not VB) project that requires a client/server piece. I know I need a winsock control, but my version of VBA (that comes with Arena Modeling and Simulation software) does not have that control.
    : : :
    : : : I've read that in VB, one can go to the projects menu and select the control. However, VBA doesn't have a projects menu. So, how can I get the winsock control in VBA? If I install VB 6 (which does allow for the winsock control), will this enable my VBA to have access to it?
    : : :
    : : : Thanks,
    : : :
    : : : Sean
    : : :
    : : Hi, let's go...
    : : You have to add winsock control to your project. Tools/References/..Browse
    : : and find your winsock OCX file (%SYSEM%MSWINSCK.OCX - by default) and add it to your project. Now, make your component like this:
    : : [code]Private myWinSock As Object
    : :
    : : Sub asdf()
    : : Set myWinSock = New MSWinsockLib.Winsock
    : :
    : : MsgBox myWinSock.LocalIP
    : : End Sub[/code]And myWinSock will behave like your Winsock1 control in VB6... You don't need this control visible on some form, do you? ;-)
    : :
    : :
    : : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    : :
    : : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    : :
    : :
    : :
    : Pavlin II,
    :
    : Thank you for your response. I tried something like this, but the winsock object never became initialized. I saw that while I was in debug mode, the line AFTER the one in which I set myWinsock showed that myWinsock was set to Nothing.
    :
    : So, I'm wondering... Is there still a licensing issue? In other literature, I've read the warning that in VBA the winsock control can't be used unless there is a design time license for it. The way to get this license is by installing VB6. My question for you is, Do you have VB6 installed?
    :
    :
    Yes, I have VB6 installed on my system.. The code I wrote do work on my system.. I've never heard about any license problem but it may be the cause.. It doesn't sound very logical (because when other apps can use your system's winsock control, why VBA shouldn't?) but who knows..

    PavlinII
  • fiz1058fiz1058 Posts: 2Member
    : : : : I have a VBA (not VB) project that requires a client/server piece. I know I need a winsock control, but my version of VBA (that comes with Arena Modeling and Simulation software) does not have that control.
    : : : :
    : : : : I've read that in VB, one can go to the projects menu and select the control. However, VBA doesn't have a projects menu. So, how can I get the winsock control in VBA? If I install VB 6 (which does allow for the winsock control), will this enable my VBA to have access to it?
    : : : :
    : : : : Thanks,
    : : : :
    : : : : Sean
    : : : :
    : : : Hi, let's go...
    : : : You have to add winsock control to your project. Tools/References/..Browse
    : : : and find your winsock OCX file (%SYSEM%MSWINSCK.OCX - by default) and add it to your project. Now, make your component like this:
    : : : [code]Private myWinSock As Object
    : : :
    : : : Sub asdf()
    : : : Set myWinSock = New MSWinsockLib.Winsock
    : : :
    : : : MsgBox myWinSock.LocalIP
    : : : End Sub[/code]And myWinSock will behave like your Winsock1 control in VB6... You don't need this control visible on some form, do you? ;-)
    : : :
    : : :
    : : : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    : : :
    : : : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    : : :
    : : :
    : : :
    : : Pavlin II,
    : :
    : : Thank you for your response. I tried something like this, but the winsock object never became initialized. I saw that while I was in debug mode, the line AFTER the one in which I set myWinsock showed that myWinsock was set to Nothing.
    : :
    : : So, I'm wondering... Is there still a licensing issue? In other literature, I've read the warning that in VBA the winsock control can't be used unless there is a design time license for it. The way to get this license is by installing VB6. My question for you is, Do you have VB6 installed?
    : :
    : :
    : Yes, I have VB6 installed on my system.. The code I wrote do work on my system.. I've never heard about any license problem but it may be the cause.. It doesn't sound very logical (because when other apps can use your system's winsock control, why VBA shouldn't?) but who knows..
    :
    : PavlinII


    : Hi,
    I'm new to winsock in macro excel and i'm hoping that you guy can help me, i'm doing a program for virtual port that macro excel can communicate with VB. Right now I have to create a program in macro excel using winsock, the problem is I do not know where i'm going to start with..

  • fiz1058fiz1058 Posts: 2Member
    : : : : I have a VBA (not VB) project that requires a client/server piece. I know I need a winsock control, but my version of VBA (that comes with Arena Modeling and Simulation software) does not have that control.
    : : : :
    : : : : I've read that in VB, one can go to the projects menu and select the control. However, VBA doesn't have a projects menu. So, how can I get the winsock control in VBA? If I install VB 6 (which does allow for the winsock control), will this enable my VBA to have access to it?
    : : : :
    : : : : Thanks,
    : : : :
    : : : : Sean
    : : : :
    : : : Hi, let's go...
    : : : You have to add winsock control to your project. Tools/References/..Browse
    : : : and find your winsock OCX file (%SYSEM%MSWINSCK.OCX - by default) and add it to your project. Now, make your component like this:
    : : : [code]Private myWinSock As Object
    : : :
    : : : Sub asdf()
    : : : Set myWinSock = New MSWinsockLib.Winsock
    : : :
    : : : MsgBox myWinSock.LocalIP
    : : : End Sub[/code]And myWinSock will behave like your Winsock1 control in VB6... You don't need this control visible on some form, do you? ;-)
    : : :
    : : :
    : : : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    : : :
    : : : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    : : :
    : : :
    : : :
    : : Pavlin II,
    : :
    : : Thank you for your response. I tried something like this, but the winsock object never became initialized. I saw that while I was in debug mode, the line AFTER the one in which I set myWinsock showed that myWinsock was set to Nothing.
    : :
    : : So, I'm wondering... Is there still a licensing issue? In other literature, I've read the warning that in VBA the winsock control can't be used unless there is a design time license for it. The way to get this license is by installing VB6. My question for you is, Do you have VB6 installed?
    : :
    : :
    : Yes, I have VB6 installed on my system.. The code I wrote do work on my system.. I've never heard about any license problem but it may be the cause.. It doesn't sound very logical (because when other apps can use your system's winsock control, why VBA shouldn't?) but who knows..
    :
    : PavlinII


    : Hi,
    I'm new to winsock in macro excel and i'm hoping that you guy can help me, i'm doing a program for virtual port that macro excel can communicate with VB. Right now I have to create a program in macro excel using winsock, the problem is I do not know where i'm going to start with..

    fiz1058
Sign In or Register to comment.