Solved

Making a POST Request From VBA

Posted on 2001-08-09
3
1,174 Views
Last Modified: 2012-05-04
I need to create an EXCEL application that POSTS data to an ASP page.  Can someone provide me with an example of how to do this in VBA?
0
Comment
Question by:ubsjmg
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
This is one approach using XML:
Make a reference to XML (this code is using v2) and add this code:

Dim xmlReq As MSXML.XMLHTTPRequest
Dim xmlDoc As MSXML.DOMDocument
Dim HTTPRequest As String

Set xmlReq = New MSXML.XMLHTTPRequest
With xmlReq
   .open "POST", HTTPRequest, False
   .setRequestHeader "Content-Type", "text/xml"
   .send vbNullString
   Set xmlDoc = xmlReq.responseXML
End With
0
 

Author Comment

by:ubsjmg
Comment Utility
So I guess then I simply read the XML file with the ASP page.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 100 total points
Comment Utility
If you want to send a XML document to your ASP then change as follows:

Dim xmlHTTP As MSXML.XMLHTTPRequest
Dim xmlReq As MSXML.DOMDocument
Dim xmlResp As MSXML.DOMDocument
Dim HTTPRequest As String

Set xmlReq = New MSXML.DOMDocument
'build your xmlReq here

Set xmlHTTP = New MSXML.XMLHTTPRequest
With xmlHTTP
  .open "POST", HTTPRequest, False
  .setRequestHeader "Content-Type", "text/xml"
  .send xmlReq
  Set xmlResp = xmlHTTP.responseXML
  'Read the xmlResp here
End With

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now