xmlHttp Post in VBA from ASP Query?

mrlemmer11

New Member
Joined
Jun 8, 2015
Messages
32
Good Afternoon,

I have been trying to no avail to get a VBA script to tunnel to my corporate reports viewer which is ASP I believe, choose a drop down choice, enter in a SKU and run the query. I have been able to successfully do it when I have VBA launch and IE window for me, but that process takes 70+ hours to go through all 47,500 skus I need to get data from. I am open to either scraping the results of the query, or I don't mind downloading a CSV for each sku and then merging all 47,500 CSV's into one sheet. With this being said, I just don't know how to make the xmlHttp method to work. Please let me know if you need any further information from me or anything I can do to assist in you helping me with this issue.

The results from this which is entered into cell(1,1) is simply showing the corporate report sites normal HTML data and nothing specific to return results when I run this.

Code:
Public Sub openWebsite(strOpenMethod As String, strURL As String, Optional strPostData As String)    Dim ws As Worksheet
    Dim pXmlHttp As Object
    Set pXmlHttp = CreateObject("MSXML2.XMLHTTP")
    Set ws = ThisWorkbook.Worksheets("Sheet5")
    pXmlHttp.Open strOpenMethod, strURL, False
    pXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    pXmlHttp.send (strPostData)




    Dim pHtmlObj As Object
    Set pHtmlObj = CreateObject("htmlfile")
    pHtmlObj.body.innerHTML = pXmlHttp.responseText
    'MsgBox pXmlHttp.responseText
    ws.Cells(1, 1) = pXmlHttp.responseText


End Sub


Sub test()
    Dim ws As Worksheet
    Dim btnSearch As String, strSearchType As String, strSearchName As String, PostData As String
    Set ws = ThisWorkbook.Worksheets("Sheet5")
    btnSearch = "View Report"
    strSearchType = "SKU"
    strSearchName = "889506830"
    PostData = "ctl32_ctl04_ctl03_ddValue=" & strSearchType & "&ctl32_ctl04_ctl05_txtValue=" & strSearchName & "&ctl32_ctl04_ctl00=" & btnSearch
    ws.Cells(2, 1) = PostData
    openWebsite "POST", "http://***************/Reports/Pages/Report.aspx?ItemPath=%2fMail+Order%2fItem%2fExpanded+Item+Lookup", PostData
End Sub
 

mrlemmer11

New Member
Joined
Jun 8, 2015
Messages
32
Please, I'm stuck until I get understand this. I searched and tried all sorts of variations of this, but none of it is working. I simply can not get the drop down to select SKU, have a SKU number entered into the next field and hit submit when I am using xmlHttp. What am I doing wrong?
 

Forum statistics

Threads
1,081,706
Messages
5,360,763
Members
400,595
Latest member
T_Dubs

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top