Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Making a POST Request From VBA

Posted on 2001-08-09
3
Medium Priority
?
1,190 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 400 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 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