Solved

Making a POST Request From VBA

Posted on 2001-08-09
3
1,181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6368191
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
ID: 6373010
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
ID: 6373060
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

617 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