BlackLabrador
BlackLabrador

Reputation: 201

Light Client using Windows Socket and Excel VBA

I have an excel workbook containing a lot of different data. On the other side, I have a server in Java that does a lot of computing work. I would need to connect my XL Workbook this server using a TCP protocol and send data from Excel to Java

What is the easiest way to do that ? I've heard that winsocks control can be used with VBA. Where can I download the library to do that (is there an official MS library ? => a lot of guy are talking of MSWINSCK.OCX, but I can't find that anywhere on the microsoft website).

Would you have an example or a link in VBA for a small project able to send data and receive data from a server ?

Thanks Rgds

Upvotes: 2

Views: 8093

Answers (1)

mupan
mupan

Reputation: 119

mswinsck.ocx is part of VB runtimes (e.g. http://support.microsoft.com/kb/932349). The same link informs about security issues possibly related to mswinsck.ocx. When you will have downloaded the most recent and hopefully most secure version of the ocx (or found it on your hard disk because you have runtime of vb installed, you might have to register it manually by regsvr32 on the Windows console. On Windows 7, you even might have to activate it additionally e.g. with this tool: http://www.nirsoft.net/utils/acm.html.

If all this is done, add a reference to your VBA project to Microsoft Winsock Control v.... (SP ...). If you prefer late binding for this, you can remove the ref later, but now it's necessary to have MSWinsocketLib available in the Object Catalogue (<F2>) in your VBA project and for IntelliSense while coding.

I found out what I am telling you by searching the internet for mswinsck.ocx site:microsoft.com, and, after a short look into the Object Catalogue, searching for a most specific expression, found: http://www.15seconds.com/issue/010820.htm where is basic information and links to further articles.

But: It seems to me Winsocket is a rather old technique. The article on 15seconds is from 2001 I guess. I won't dig further because we early ref winsck.ocx and thus force admins to install our software to regsvr32 mswinsck.ocx for a reason I don't wanna know. Maybe just to let admins know how ripe our software is ... On the pages the search engines found alternatives like csocket (API) are mentioned, so please dig further.

Since this is no solution but just hints and discussion I would have preferred to just comment your question, but there is no link for me to add a comment, I might lack a funny stackoverflow right.

Upvotes: 3

Related Questions