Import Web Page Via XMLHTTP

Feb 21, 2008

I am trying to automate data downloads into Excel from a webpage, similar to webquery but slightly more complex. In the browser I can only get the data I want if I select a checkbox. As soon as the checkbox is clicked, the webpage reloads with the right data, and this is what I am trying to import into Excel via XMLHTTP.
The html/javascript code related to the checkbox on the website is:

<form method="post" name="tsOptions">
...
<input type="checkbox" name="allRecs" onclick= 'form.submit();'>
...
</form>

The ... contain some html stuff and further controls like radiobuttons. Anyway, I know how to load the website into Excel VBA as is before the checkbox is selected. Now how do I implement this PUT/submit.form() thing? the VBA code so far is:

Set oHttp = CreateObject("MSXML2.XMLHTTP")
oHttp.Open "GET", "http://...?option1=...&option2=...", False
oHttp.send
a = oHttp.responseText 'a contains source code of website

View 3 Replies


ADVERTISEMENT

Import Web Page With VBA

Jul 20, 2009

I need to get VBA code to import a web page one at a time based on a condition. When one of the urls below has "1 mins to post", I want that page imported into a worksheet.
The pages require a login and here is the source code for login - "acctnum" and password - "zipcode". The name for "1 mins to post" is name ="MTP".

I would want to keep the page loaded until "MTP" = OFF. Then whenever the next URL goes to "1 mins to Post", load that web page and keep it loaded until "OFF" and so on.

This would need to continually scan through all of the following urls:

http://tote.phonebet.com/WPSARL-C.PHP
http://tote.phonebet.com/WPSBEL-C.PHP
http://tote.phonebet.com/WPSCAL-C.PHP
http://tote.phonebet.com/WPSCAN-C.PHP
http://tote.phonebet.com/WPSCTN-C.PHP
http://tote.phonebet.com/WPSCTN-C.PHP
http://tote.phonebet.com/WPSCOL-C.PHP
http://tote.phonebet.com/WPSDPK-C.PHP
http://tote.phonebet.com/WPSELL-C.PHP
http://tote.phonebet.com/WPSEMD-C.PHP
http://tote.phonebet.com/WPSFMD-C.PHP
http://tote.phonebet.com/WPSFLK-C.PHP
http://tote.phonebet.com/WPSFTE-C.PHP
http://tote.phonebet.com/WPSHAS-C.PHP

View 9 Replies View Related

Import From PDF Embedded On Web Page?

Dec 15, 2009

Working on automating a data update process for my department (well, for the Italian speaking analysts anyway). I'm trying to import data from an embedded PDF to my Excel 2007 worksheet - I only need the data on the PDF, but if the whole screen can be scrapped I can clean it up in my code.

Any ideas if/how I can do this?

View 12 Replies View Related

Import Chart From Web Page

Feb 12, 2008

There is a chart at the center of this page:
http://charts3.barchart.com/chart.as...K&org=stk&fix=
I can't import it into excel using DataImport External Data New Web query
Is there a way to grab that data in VBA or in Excel somehow?

View 2 Replies View Related

Switching Page Numbers During XML Import Using VBA

Aug 4, 2012

I've been programming my VBA script to import data from an XML file which looks like this:

HTML Code:
<response responseStatus="success"> <result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:type="apiPagination"> <currentPage>1</currentPage> <list xsi:type="apiReport"> <Variable1>Name1</Variable1> <Variable2>41</Variable2> </list> <list xsi:type="apiReport"> <Variable1>Name2</Variable1> <Variable2>20</Variable2> </list>

So far everything works great and it imports everything correctly to Excel 2010. This is the code I'm using:

Code:
Sub test()
Dim WS As Worksheet: Set WS = ActiveSheet
Dim req As New XMLHTTP
Dim Link As String
Dim PageNumber As Integer
Dim Url As String
PageNumber = 1

[code].....

The problem is that I only import page1 (only link [URL])

How do I get all URLs so that it also imports the data located on other pagenumbers? For example [URL]

View 1 Replies View Related

Import Web Page From Mirror File

Nov 16, 2009

I have some software that was written for me that scrapes data. It has a file in it that mirrors the web pages that it is scraping.

I would like to actually import those web pages one at a time based on a condition in the browser. The code of the web page is html. When one of the 35 mirror web page's "MTP" = "POST", I would like for all the web page to be loaded into a sheet called WPS. I would want that to stay loaded until "MTP" = "OFF". There may be more that one of the mirrored web pages with "MTP" = "POST". In that case, only one can be loaded at a time and that is fine. Once the "MTP" = "OFF", I want it to go to the next mirrored web pages with "MTP" = "POST" and load that web page from the mirror file.

Here are 4 of the 35 web pages that are mirrored and their paths
C:TotearkmantotemirrorWPSAQU.HTM
C:TotearkmantotemirrorWPSBEY.HTM
C:TotearkmantotemirrorWPSCTN.HTM
C:TotearkmantotemirrorWPSDDN.HTM

View 9 Replies View Related

XMLHTTP: System Cannot Locate The Resource Specified

Aug 5, 2009

i am getting the error run-time error '-2146697211 *800c0005)'': the system cannot locate the resource specified

when running the following:

my guess is because sometimes the internet connection doesnt always work, or the page loads too slow, but 'on error resume next' doesnt work because the line takes awhile to execute and then excel turns off

i believe i saw somewhere here (mrexcel) how to give specific commands a limited time to run. i dont rememeber how to do this though, or any other workaround ...

View 9 Replies View Related

Simultaneous XMLHTTP Posts W/Event Handler

Jul 12, 2006

I have a standard module in which I gather information from a workbook, create an XML document, Post it, and collect the value I need from the response XML. Thing is I have to run through it maybe hundreds or thousands of times depending on the number of records I have. It takes ten years to finish the loop. I have read that it might be possible to post them concurrently using a class module and an event handler, but I have not worked with Class modules before. Compiling all the XML documents into memory is easy, posting them and getting my return values in a timely manner is the problem at hand.

View 2 Replies View Related

Xmlhttp Object Causing System & Runtime Error 1072896658 (c00ce56e)

Aug 23, 2007

I have just signed up to the forums as I am having a very specific problem. I have looked on google and used the search feature (on several forums!) and found very limited information that is useful to me. I am having trouble with a very simple few lines of code in a macro. The code looks like this:

Function startmarketIDs()
Dim targeturl, writerow, readrow, textmass, xmlHTTP
targeturl = "http://lite.betfair.com/ Events.do?s=00010913z"
Set xmlHTTP = CreateObject("Microsoft.xmlHTTP")
xmlHTTP.Open "GET", targeturl, False
xmlHTTP.send
MsgBox xmlHTTP.StatusText
textmass = xmlHTTP.responsetext
MsgBox textmass
End Function

My problem occurs at the line "textmass = xmlHTTP.responsetext". The responsetext command is obviously causing problems because if I remove it, the code executes without error and the "xmlHTTP.statustext" says "OK". With the responsetext command left in, the code generates the following error: Run-time error '-1072896658 (c00ce56e)': System Error: -1072896658. If I change the targeturl to www.betfair.com, the code executes fine and I get a message box (as desired) with the source code of the website displayed. Without meaning to sound like Im answering my own question (!!), perhaps there is something about the url or the way in which I am using the xmlHTTP object that is causing the issue, I wondered if someone would mind inspecting my code and perhaps pointing me in the right direction?

View 2 Replies View Related

Page Break Preview It Shows The Page Numbers In The Centre Of The Page

Jun 9, 2009

When I view a sheet under Page Break Preview, it shows the Page numbers in the centre of the Page. While I am aware that it would not print the page number I was wondering if there is an option to remove/hide the page numbers.

View 3 Replies View Related

Import Multiple Text Files & Copy Each Import

Jan 29, 2008

I'm attempting to import around 200 (and growing!) separate text files into Excel. I am using the formula below to import the text file and then using a separate macro to select the information I need, copy it into another spreadsheet, and then run the import macro again.

However, I have a problem in that my import macro gives me 'Run-time error '1004:

Application defined or user defined error''. At first this wasn't a problem as the information is pasted into the spreadsheet despite the error anyway. However, now that I am looping the macro it is obviously causing more problems as it prevents the loop. I would really appreciate it if anyone knows of a work-around or can spot an error in the coding to resolve this!

The code below shows is for the import macro only:

Sub ImportTextFile(FName As String, Sep As String)

Dim RowNdx As Long
Dim ColNdx As Integer
Dim TempVal As Variant
Dim WholeLine As String
Dim Pos As Integer
Dim NextPos As Integer
Dim SaveColNdx As Integer

View 8 Replies View Related

Put In Error Handling In Case The Format Of The Page Changes Or The Internet Page Is Unavailable

May 18, 2006

I have some code that parses an html table. I want to put in error handling in case the format of the page changes or the internet page is unavailable. I am testing without an internet connection and the run time error is not being branched off to the error handler and is fatally ending the macro. This is true also if I raise an error manually.

Private Sub ParseInjuryPage()
On Error Goto ErrorHandl
Dim strPage As String
Dim webIE As SHDocVw.InternetExplorer
Dim myURL As String
Dim tableBeg As Long
Dim tableEnd As Long
Dim RowBeg As Long
Dim rowEnd As Long
Dim cellBeg As Long
Dim cellEnd As Long
Dim strBeg As Long
Dim strEnd As Long
Dim myCell As Range
Dim rowNum As Integer
With Sheets("INJ")
Set myCell = .Range("A2")
.Range("A:F").Value = vbNullString
rowNum = 2
Set webIE = New SHDocVw.InternetExplorer
myURL = "http://www.sportsline.com/nfl/injuries"
webIE.Navigate myURL
Do Until webIE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
strPage = webIE.Document.body.innerhtml...................................

View 6 Replies View Related

Import CSV Every X Minutes Without Import Dialog Appearing

Apr 1, 2008

I have a simple macro importing a .csv data file to a worksheet every 30 minutes.

When the macro runs an Import Text File dialog box displays.

What do I need to do to have the macro run to completion without the dialog box interruption?

Sub RefreshHourlyData()

htime = Now + TimeValue("00:30:00")

Application .OnTime htime, "RefreshHourlyData"

Sheets("H1Updates").Select
Sheets("H1Updates").UsedRange.Select

Selection.QueryTable.Refresh BackgroundQuery:=False

Range("A1:A1").Select

End Sub

View 3 Replies View Related

Can't Move Page Breaks In Page Break Preview

Mar 26, 2006

I suddenly can't adjust my page breaks in any Excel spreadsheet while in Page Break Preview. Is there some option to turn it on and off?

View 7 Replies View Related

Print To Fit All Rows And Column On One Page And Take Up Entire Page?

Oct 16, 2013

I have a sheet that changes the number of columns based on data from other sheets. This is the only sheet in the workbook that I will print out every day. I have it set right now to fit all columns on one page, however sometimes this will result in the bottom 1/3rd of the sheet not being used. If I use fit all rows on one page, then some of the columns will get cut off. Is there a way to scale in both directions? My guess is there is not, but I thought I would ask because it would work great for me if I could.

View 4 Replies View Related

Printing One Page Grayscale And One Page Color With Code

May 21, 2009

I have a report that I use and right now I have a command button that prints the report x2. What I would like to do is to have it print one in color and one in grayscale. I could do this I think with two different buttons, but I would like to utilize just one. I tried creating a macro but it did not pick up the fact that I changed the properties to black and white.

View 2 Replies View Related

Countif Formula: Take Data From One Page And Graph It On Another Page

May 1, 2009

I am looking for a formula that will take data from one page and graph it on another page. The data I am trying to graph is arranged like so:

A B

1 q 2009.05.01
2 w 2009.05.02
3 w 2009.05.01
4 q 2009.05.01

I am looking for something that will look at column A and if the answer is "q" and then look at column B and if the answer is "2009.05.01" Excel will take that and count it in a specific cell on another page. In the case above, I want Excel to give me the answer of "2" in a designated cell.

View 3 Replies View Related

Change Start Page Of Multi Page UserForm

Jul 23, 2006

Is it possible to Change Start Page Of Multi Page UserForm Based on 8 CommandButtons. on a WorkSheet, for example.

CommandButton1
UserForm1.MultiPage1.Value = 0
CommandButton2
UserForm1.MultiPage1.Value = 1
CommandButton3
UserForm1.MultiPage1.Value = 2
CommandButton4
UserForm1.MultiPage1.Value = 3

Could I use 1 multipage UserForm Instead of 8 UserFoms. Is it better to use 1 multipage UserForm with 8 pages or 8 UserForms. I dont know if this make sense or not?

View 2 Replies View Related

Transfer Specific Data On Each Page To A Different Colum On That Same Page

Mar 15, 2007

I have a workbook that has 9 different tabs in it. Once all the information has been completed throughout the workbook, is there a code that could transfer specific data on each page to a different colum on that same page? I need to do this for 9 pages at one time. The information is listed differently on each page. I need to transfer data from the current data column to the previous data column once the entire workbook has been filed out.

View 2 Replies View Related

Remove Page Numbers In Page Break Preview

May 18, 2007

how to get rid of the page numbers that appear when using page break preview mode. The page numbers appear in large grey font in the middle of each page and sometimes makes it difficult to read cells. Can I use this view with all the same functionality without that one feature?

View 3 Replies View Related

Macro To Print Page Based On Active Page

Jun 29, 2007

I need a macro that will print a hidden page that is linked to the page I have active.

It needs to be able to find the correct hidden page that corresponds to the active page because there are multilple pairs of the hidden/visible pages. The name of the hidden page is the same as the visible one with "printout" added to the end. When created, the sheet code names are sheetn and sheetm; n and m being consecutive numbers.

View 3 Replies View Related

Wondering How To Keep Headers Repeating From Page To Page.

Nov 4, 2008

Working with 2000 Excel is bringing some new chalanges. I see things are done different. I am trying now to keep my header to repeat from page to page.

For example I have a header that may say something like:
People, numbers, date, ect. And there are so many new rows they go on for pages long. How can I keep my header on the top of each page when it prints out on paper.

View 5 Replies View Related

Formula On A Page Updated When Any Value On The Page Is Changed

Mar 27, 2009

Assume that calculation is set to automatic and not manual, then is every formula on a page updated when any value on the page is changed, or only when the values in the cells pertaining to a particular formula change?

For instance, if cells a1-a10 have values and in a11 is a sum a1-a10 formula, and in b1-b10 are values and a sum b1-b10 formula in b11, if I change a value in range b1-b10 but do not change any values in a1-a10,then as well as the formula in b11 updating will the formula in a11 recalculate or does excel keep track of which cells have changed and thus is aware that the formula in a11 does not need to be recalculated?

View 3 Replies View Related

Copying 12 Months Data Across The Page To Down The Page

Oct 17, 2008

I have a dataset that is as follows:

Col1 2 3 4 ...... 45

123 456 xxx xxx xxx
100 234 xxx xxx xxx
221 543 xxx xxx xxx
112 234
112 689
122 956
122 234

This goes on from left to right for 45 odd columns.

I need to copy each set i.e set 1 is 123 down to 122 to say cell a25 and then copy the next set i.e. 456 to 234 below the first set.

I need to somehow write a loop code that knows where to get the 2nd, then 3rd set, etc and copy it to the bottom of the preceeding set

View 9 Replies View Related

Fill In Page From Another Page In Workbook

Dec 26, 2013

What I want to do, is to populate the Lois, Beth, Kelly and Shelley pages with the rows from the Que page when they get assigned to one of them. I tried to program then off of a different example in the forum. It didn't work. Will include the copy.

Tracking(HELP).xlsx

View 6 Replies View Related

Showing Current Page Number And Total Page Number In Entire Workbook?

Nov 14, 2013

In my header I am trying to show the current page number and the total number of pages in the workbook. So if I have 10 pages in my workbook, page 5 would read "5 of 10".

I have this in my header "&[Page] of &[Pages]". All worksheets with 1 page read "1 of 1" and worksheets with 2 pages read "1 of 2" on the first page and "2 of 2" on the second page.

View 6 Replies View Related

Page Break By Asking The Input File For Page Break To Be Done

Dec 9, 2008

The code which you provided works fine no problem for a page break. I need to run the macro for the page break by asking the input file for page break to be done.

For Example, If excel filename "A" contain the code which you have given need to ask to input the filename "B" and process need to be done in file "B".

I have added some code to your code which you provided but it gives error message "1004" "Method 'Range' of object '_Application' failed" at following line :

Set rng = oExcel.Range(Cells(2, 2), Cells(Rows.Count, 2).End(xlUp))

View 12 Replies View Related

Macro: Clear Page Breaks & Add Page Breaks

Nov 28, 2006

I need to remove all existing page breaks in a document and add a page break every 72 rows. I've tried some similar codes from this forum with other functions that I don't need in it.

View 7 Replies View Related

Page Header: Print The Header On Page One Only

Mar 5, 2009

I have a booklet I want to print from Excel 2000. I'm not seeing how to have the HEADER on page one only. The header is coming up on all pages. Is there a way to tell Excel to print the Header on page one only?

View 2 Replies View Related

Import From Web

Feb 27, 2008

I have the tedious task of building a visitor database, i have a web page with over 300 records on it, each record containing information such as company name, address, phone number email and this is only the first web page i have to visit, that's already over 1000 copy and pastes.

I'm wondering if there is a way to just capture all of the information on the web page and then populate my excel spreadsheet with information falling under the appropriate headings.

I tried the method of right clicking on the web page and said import to excel, but as you can imagine this just resulted in all of the data appearing in one column and i would still have to move all the information around so it is not of much help.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved