Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Socket/HTTPWebRequest Connection in VBA (no ADO)

Status
Not open for further replies.

dbarbarian

Programmer
Jun 28, 2006
3
US
Hi. First time posting here.

I just dove into VBA recently in Excel 2003 and I have a small problem. I would like to create a socket connection to a target URL and be able to stream data to it and from it. However, after searching for 2 days, I came up with nothing.

Objects and methods like the ones in VB or C# would be nice. For example:

Stream in = new FileStream(inFile, FileMode, FileAccess);
Stream out = new FileStream(outFile, FileMode, FileAccess);
CookieContainer cookies = new CookieContainer();
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

But I haven't found anything that can achieve what that does.

Any ideas?

Thanks in advance,
DBarbarian
 
Oops. Fogot the streaming part from the C#

Stream uploadStream = webRequest.GetRequestStream();

Is this even possible in VBA Excel 2003 (NON-professional).
 
dbarbarian,
Can you acheive this by adding a reference to Microsoft WinHTTP Services, version 5.1 (winhttp.dll) to your Excel project?
I don't know if this is included with the standard delivery of Office (I've got so much crap installed I have no idea where it came from).
I have used it to request web pages for the purpose of mining data. It has a [tt]ResponseStream[/tt] (which I could never make work), and a [tt]ResponseText[/tt] property which worked for my purpose.

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Thanks for the reply. I looked at it, but couldn't figure it out.

Although, I could create my own reference through using C#. I think that would work. Thanks for suggesting using references. =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top