tags:

views:

704

answers:

3

I have been asked to make a Macro which sends the Excel Data to a Website. There should not be any database involved. I have been trying to use HTTP Post after reading examples on this website. I have made a ASP.NET webpage which runs on localserver. While debugging the macro, the control does reach the webpage Page_load event but I am unable to see the data there.

Can anybody help me find my mistake?

Thanks

Abi

A: 

Does the 'website' have to be a standard webpage? Can you not send it to a 'website' running an ASP.NET WebService instead?

See here & here on how to write a webservice, and then read here & here on how to call the WebService via VBA.

mundeep
A: 

Although I can't give you an exact example in Excel, I'm pretty certain Excel has a function or two to lookup values from any website using a GET request. The difference between a GET and POST request is that in the former all data passed is part of the URL string. Assuming the HTTP support in Excel is basic, I suspect you will have better luck using a GET request, carefully building your URL with the data with simple string manipulation. Although I do not know the exact syntax, imagine a formula in a cell like =lookuphtml("http://some.url.com/send?var1="&B2&"&var2="&B3), where cells B2 and B3 would contain your variable values (the values you want to pass to the script). This assumes the receiving end is capable of receiving data through GET requests (not only POST requests). Most decent server-side libraries allow data passed through both GET and POST request, although YMMV.

Marius Kjeldahl
Thanks for taking out time, but I can not send the data by appending it to the URL (which is working) as the data can be huge and sensitive.
A: 

I'm not a .NET guy but it looks very much like URI.Query would only show the GET data because POST data isn't part of the URI.

You might want to look at using the standard form syntax of name1=value1&name2=value2&... in your sData string and then on the server use Request.Form as per the examples here

barrowc