Parse HTML Code, Create A Table

Mar 13, 2008

I have a function that locates a table on a webpage and pulls the html code into one cell in a worksheet. Basically we can call this one cell a text file. I need to parse through this text file (cell A1) to create a table. This text file only has info for 1 table, the table always has 12 columns, the rows are variable. I would like it to then write back this parsed text file back into excel as a table, say starting in cell A2 on the same worksheet.

View 9 Replies


ADVERTISEMENT

Parse HTML Code / Copy Image And Paste Back In Excel

Aug 6, 2012

I am attempting to navigate to a webpage using IE. I have been successful at getting to the appropriate webpage.

However, I would like to open a link within the webpage in the browser in another window(Which is an image). Copy the image then paste it back into excel. I have been successful at opening the webpage using a Userform.

Code:
Sub Anthro()
Application.ScreenUpdating = False
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True

[Code] .......

The user input number for example:

If the user inputs the number 25423310 into the txtbox then it navigates to a certain webpage.

On this webpage and all other webpages where different #'s are used are very similar. The number (25423310) is always used to identify an image. However it has more characters. For example the image is always on line 30 of the HTML code. On this example the HTML code lists the image as:

The number used in the txtbox to naviagete to the URL Ex: 25423310) is always within line 30 of code in HTML. Is it possible to run a query or parse this line of code and direct ie to open this image in a new window then copy and paste it based on the criteria of the user input? Ex. 25423310?

Code:
Sub PropInfo()
Dim appIE As SHDocVw.InternetExplorer
Set appIE = New SHDocVw.InternetExplorer
Dim varTables, varTable

[Code] ....

View 9 Replies View Related

Create Html Table From Range Of Cells

Apr 17, 2007

I am trying to output tables from excel to an HTML file using the following subroutine. It creates the table as I would like, but I am having a brain cramp trying to figure out how to get the cell data into the routine. The part in error is in the code below, in Red. I need some way of entering something like " Sheet(SheetNum)&.Range(Column&Row)&.Value"

Private Sub CreateTable(Center As Boolean, Border As Integer, Width As Integer, SheetNum As Integer, StartRow As Integer, EndRow As Integer, StartColumn As Integer, EndColumn As Integer)
Dim Row As Integer
Dim Column As Integer
Dim ColumnID(1 To 15) As String
Dim CellLoc
ColumnID(1) = "A"
ColumnID(2) = "B"
ColumnID(3) = "C"
ColumnID(4) = "D"
ColumnID(5) = "E"
ColumnID(6) = "F"
ColumnID(7) = "G"..................

View 4 Replies View Related

Parse HTML Text Extract From Webpage

May 20, 2008

I am attempting to extract a particular piece of data from a webpage. I was not able to use a webquery because the data can only be reached by searching an online database and the URL remains static throughout this process.
http://gisims2.co.miami-dade.fl.us/myhome/proptext.asp

The data of interest is contained in a simple, 2-column table with item descriptions in the first column and item values in the second. The code below is my closest attempt. I am attempting to look through the innertext of all the tables on the results page and see if any contain the text "CLUC", which is the description of the data I'm trying to retrieve. The code never finds any qualifying tables.

Sub PropInfo()
Dim appIE As SHDocVw.InternetExplorer
Set appIE = New SHDocVw.InternetExplorer
Dim varTables, varTable
Dim varRows, varRow
Dim varCells, varCell
Dim lngRow As Long, lngColumn As Long
'OPEN INTERNET EXPLORER, GO TO WEBPAGE
appIE.Visible = True
appIE.navigate "http://gisims2.miamidade.gov/MyHome/proptext.asp"
Do While appIE.Busy: DoEvents: Loop
Do While appIE.readyState <> 4: DoEvents: Loop.........................

View 2 Replies View Related

VBA Code To Extract HTML Table Data To Worksheet

Apr 30, 2013

I am trying to extract the data values from the references Bundesbank page and get them into a worksheet so I can manipulate from there. What I have is below.

Code:
Sub Get_Data()

Dim IE As New InternetExplorer
IE.Visible = False

[Code] .........

View 9 Replies View Related

Parse Worksheet, Create Multiple Worksheets

Jul 20, 2009

I have a single worksheet containing data in columns A-J. I need to Copy all cells to a new work sheet when the value in column A changes. The worksheet should be named the value of column A. I have found thread 656226, but am unable to modify to work.

View 8 Replies View Related

Excel 2010 :: VBA Code To Extract HTML Source Code Not Working On Google Sites

Dec 6, 2012

I have previously used the following code to successfully pull out IE webpage source code for string manipulation.

Its a crude example to demonstrate the principle:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public IE As Object
Sub Sample()
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

[Code] ......

However when I substitute in a Google websites address into the IE.Navigate command, the code runs to the "Source_Code = IE.document ...." line then flags up a Microsoft Visual Basic error. "Run-time error '438': Object doesn't support this property or method"

The webpage that I am trying to access is a confidential company site, so you won't be able to access it yourself, but starts with [URL] ......

The one thing that I have noticed about this website is the Privacy Report icon in the lower right status window (Picture of an eye with a restricted symbol in front). I don't know whether this is the cause of my problem, or purely an incidental observation.

Is there something peculiar with Google sites that means that the source code cannot be extracted in general, or is this an issue specific to my site ? Does the Privacy Report icon have any relevance, and if so how do I switch that off ?

Using :
MS Excel 2010
IE Explorer 8.0

View 1 Replies View Related

Macros To Create HTML

Nov 6, 2009

I have a couple spreadsheets which update using a RTD link. I then use Macros to sort it and publish a html file every 30 seconds.

I found the html macro thanks to : http://www.meadinkent.co.uk/xlhtmltable.htm

The problem is that whenever I run two sheets together, the macro that creates the html file at times gets the data off the wrong worksheet. Sometimes I only see one sheet's data being used, sometimes the other.

Both html files when published have some feature from one macro and some from the other macro. Like macro one sheet says use 1528 rows and the title for page is Relative Strength Over 750K. Other macro says use 979 rows and title for page is Relative Strength Under 750K. I would have both the sheets as like 1528 rows for with title Relative Strength Under 750K.

If I run one sheet at a time, everything works fine.

Here are the Macro codes for Sheet #1:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime dTime, "Macro1", , False
End Sub

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:30"), "Macro1"
End Sub

Module 1

Public dTime As Date

Sub Macro1()
dTime = Now + TimeValue("00:00:30")
Application.OnTime dTime, "Macro1"
Columns("P:AH").Select
Selection.Sort Key1:=Range("AG1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Application.ScreenUpdating = True........................................................

View 12 Replies View Related

Create A New Table That Displays The Information By Location Instead Of Code

Sep 7, 2007

I have a table of information with location codes as the column headers. Each location has from 1 to 6 codes associated with it.

I want to create a new table that displays the information by location instead of code, i.e. adding all of the codes for a location into one column for that location.

I'm hoping the example will make this clearer.

On the main page, I am trying to add in the wa column all of the columns in the raw page that have a code associated with wa as the header.

To make this more complex, I can't use vba on this one.

the only thing I've got so far is a very long, very complex formula that adds together numbers generated from index/matching each entry in the second table.

something like this.

(edit changing 1:1 to $1:$1)

=IF(VLOOKUP(B$1,lookup1,2,FALSE)=0,0,INDEX(sample.xls!main_table,ROW(),MATCH(VLOOKUP(B$1,lookup1,2,FALSE),raw!$1:$1,0)))+IF(VLOOKUP(B$1,lookup1,3,FALSE)=0,0,INDEX(sample.xls!main_table,ROW(),MATCH(VLOOKUP(B$1,lookup1,3,FALSE),raw!$1:$1,0)))+IF(VLOOKUP(B$1,lookup1,4,FALSE)=0,0,INDEX(sample.xls!main_table,ROW(),MATCH(VLOOKUP(B$1,lookup1,4,FALSE),raw!$1:$1,0)))+IF(VLOOKUP(B$1,lookup1,5,FALSE)=0,0,INDEX(sample.xls!main_table,ROW(),MATCH(VLOOKUP(B$1,lookup1,5,FALSE),raw!$1:$1,0)))+IF(VLOOKUP(B$1,lookup1,6,FALSE)=0,0,INDEX(sample.xls!main_table,ROW(),MATCH(VLOOKUP(B$1,lookup1,6,FALSE),raw!$1:$1,0)))


It works, but its horribly ugly, and if the number of locations goes higher (we could be looking at going to ten location codes for one of our locations) then I'll actually exeed the 1000 characters per formula limit!

View 9 Replies View Related

Parse Worksheet Names Directly In Code

Aug 6, 2008

I am trying to add new worksheets at the end of the existing ones, with the name "Scenario " & i (i being an integer for the next scenario).

My idea is to parse the Worksheet names, counting how many times the string "Scenario " appears, and then add a new Worksheet with that name and index i+1. Here is the

Public Sub store_data_Click()

Dim NameWS, prev_sheet As String
Dim iprev, iws, iscenario As Integer

iscenario = 1
For iws = 1 To Worksheets.Count
If Find(Sheets(iws).Name, "Scenario ") = True Then
iscenario = iscenario + 1
End If

1.- Find (8th line) does not seem to be the right procedure to use; how could I do this in a clean/direct (i.e. not writing the names into a dummy worksheet and using the find function) way?

2.- How could I substitute the new Worksheet ("Scenario " & i) formulas for values without having to select all the cells and then use paste values (not so elegant).

3.- Connecting to a previous post: How could I define *exactly* the position to paste "Autoshape 1"?

View 4 Replies View Related

Parse Text File To Provide Specific Table Like Format

Jun 10, 2009

I need help urgently for parsing a text file to have a specific format. The text file is of format mentioned below: ...

View 9 Replies View Related

Macro Code Create Pivot Table Based On Dynamic Source Data

Nov 28, 2006

The "Sum" sheet can change its number of rows. The pivot table is based on it. I'm having trouble with the SourceData portion of the code in my macro ....

View 9 Replies View Related

Import HTML Table Into Excel?

May 13, 2009

I am familiar with VBA, but this one has me stumped! Basically, I want to have Excel fill out an Aspx form, submit it, and then pull in the data from the html table that the form produces. There are multiple queries it would have to do, so I would want it to loop through until it is done with my list of inputs. I don't even know where to start...

The website I need to pull data from is: [URL]

On the form, there are multiple fields, but the one I am interested in is the "Study Area Code." An example input I would have in this field is "529910." I would have a different sheet in my workbook with all the SACs I need to pull.

My vision for the end result is to have all the data pulled into one sheet.

View 9 Replies View Related

How To Save HTML Source Code From VBA

Sep 22, 2008

I would need to get HTML source code from any given page. I know how to open a HTML page from Excel and I can do it with VBA, but how to get for example this page's source code?

I would start with making a sub that takes a string (the address) as an input parameter and finish with saving the source code of that address as an text file like c:code.txt

So something like

Dim webaddress as string

Sub GetSourceCode(webaddress)
'then some code to save the source code
End Sub

View 9 Replies View Related

Code To Open Html File

Apr 22, 2007

I need vba code to open a HTML file when i click a button in microsoft excel.

View 2 Replies View Related

Place / Pull Html Table Into Worksheet

Feb 29, 2008

I need to copy/cut and paste an Html table from a website into and Excel sheet without the data being transposed. See link for the table I need to get into Excel:

http://www.voedingswaardetabel.nl/voedingswaarde/?vw=vv

Then cut and paste it to Excel, you see the data is now vertical. I need the table horizontal as it appears on the website.

View 2 Replies View Related

Open HTML Docs In Excel Via VBA Code?

Jan 16, 2013

I have received several hundred "Excel" data file dumps from an unspecified corporate database ( SAP? ). They are nominally spreadsheets, that is they are tables of mixed data that Excel recognizes, as they are exported from the database as such.

I'd like to walk a directory containing these files, and only these files, open each in turn save them as proper Excel files and close them. The end goal is to import these tables into a Access database, but Access doesn't recognize them either. I also need to repair values in one field which is easier to accomplish in Excel.

Unfortunately, opening the file generates an error I've been unable to trap, due to the fact the excel thinks its an HTML file, which it is, and wants me to verify that I do want to open it. Similarly, I receive a message when I try to save the file that requires me to nominate an acceptable Excel file type, which I can do in code.

View 4 Replies View Related

Combine Cell Content Into HTML Code?

Jun 2, 2013

Taking advantage of csv files and importing into websites. Basically I have a html code in a cell which needs to pick out content from different cells in the same row. Is that possible?

<a href="/signup?name=A2&email=B2">Go</a>

So the A2 and B2 would be contents of their respective cells. Tried out a few things but kept getting errors.

View 1 Replies View Related

Search HTML Source Code For Text

Oct 21, 2009

I need to check a website daily to see if a link has been updated. If it has been updated, the beginning of the link changes to a different date. Example: today link is www.10212009dave.com and tomorrow link may be www.10222009dave.com. Lets say the link is on www.gugg.com. The link does not change everyday, but I think a good way to see if it has been updated is to search through the source code in the html for that link.

Thus I would put www.10212009dave.com into cell A1 and tell excel to search the source code on www.gugg.com, and if the contents of cell A1 is NOT found, I'd display a message box stating the link has been updated.

View 9 Replies View Related

Userform Webbrowser To Preview HTML Code.

Oct 26, 2009

What i was thinking of trying to do is. I am sending a HTML E_Mail from vba. i have a string that contains the HTML Code looks like

View 2 Replies View Related

Extract Words From Within Text Of HTML Code?

Nov 5, 2012

Many lines on my sheet have the following text in col B.

****** http-equiv="Content-Type" content="text/html; charset=UTF-8"> ****** name="generator" content="http://www.movabletype.org/"> Church Marketing Sucks: Evangelism & Outreach Archives

Is there a way to extract all the text or words between the and tags and put the extracted text into col D?

View 1 Replies View Related

Find And Return Text From The HTML Code

Dec 27, 2006

I am trying to log a specific portion of code from a webpage. The line of code looks like this:

View Details

I need to extract the userid protion, the part between "=" and "'target...." and then

View 9 Replies View Related

Getting The Entire HTML Source Code From A Web Page

Feb 12, 2010

I am looking to read the source code for a website that keeps the stats for a hockey league in Sweden

For other sites i can use the code below and it works fine, but the site i am using to get the Sweden stats seem to keep the data in some type of a Java app (sorry still somewhat of a newbie) and doesn't work the same as the others

when i veiw the source code just by right clicking the page all the data i want shows up. When i try to use my code it doesn't get the stuff i want.

I have tried both objDoc.body.innerHTML and objDoc.body.outerHTML and i get different results but not the same as right clicking on the page and viewing the source, is there another command that i can use to get it all?

the website is

HTML [url]

Sub Get_Stats()
Const strURIpre As String = [url]
Set ie = CreateObject("internetexplorer.application")
ie.Navigate strURIpre
Do
If ie.ReadyState = 4 Then
ie.Visible = False
Exit Do
Else

View 9 Replies View Related

Import HTML Table To Excel Without Line Breaks?

Jan 31, 2012

I have an html table (3 columns) that has a decent amount of formatting in each column. It uses the <P> attribute for seperating content blocks in each cell along with Lists (LI's) and OL's. It breaks the content on each <P> and <LI> attribute and places each item on a seperate line. I want the content to all be in one cell. I've heard about using a css style to make it stay in the same cell, but it doesn't seem to do anything at all. I've tried:

HTML Code: 

<style type="text/css">
br {mso-data-placement:same-cell;}[code]....

any way to import this table into excel without all the line breaks?

View 7 Replies View Related

Copy And Paste Table Into String In HTML Format

Dec 22, 2008

I want the same affect as copy a table and pasting into the email. So i guess i need to copy a range and save as html in a string. It seems like it would be simple since its just copy and paste into the email, but i've been unable to find anyting on it.

View 3 Replies View Related

Import Java Script Table From HTML File

Jul 24, 2009

I have an htm file, and i see the table. But when I go to import, it only brings in a few words -- none of the tables that I clearly see. I noticed that the tables appear to be created using Java. How do I import the table. If I select and copy/paste it works -- but I have 100s of these and I would prefer to figure it out and then program it.

View 6 Replies View Related

VB Macro For Variable Cell Merge Into HTML Code Based On Criteria

Oct 7, 2009

Does anyone have a VB macro that will copy information from a cell (this will be variable based on criteria) and paste it into the middle of another cell that contains HTML code?

The criteria for the copy/insert/paste is that the information in the cell that is to be copy/inserted must match up with the correct number (part number).

I hope this makes sense. I have attached an example spreadsheet. (Pictures are worth 1000 words. ) Hope someone can help. I checked this site and couldn't find anything that was solved that matched the specifics.

View 6 Replies View Related

Text Align Cells In Table Being Created In HTML Outlook Mail Item

Aug 11, 2014

I've got the following code and have been trying to make the cells in column 1 align TOP LEFT but haven't been able to.

[Code] .......

View 2 Replies View Related

Macro To Create A Statistics Table From Another Data Table (containing Merged Cells)

Apr 14, 2009

I would like to have a macro to automatically generate a statistics table (on the "statistics" tab) with the 5 following fields:
Fragment names / # samples / # of failed samples / % of success / # of variations in the fragment (SNP). At the bottom of this table, I would like to have a cell with the average % of success for all fragments. The data to generate these statistics are on the "gene name" tab (please note that this name will change every time I will work on a new gene). To make things easier, I think the macro should be run from this tab.

1. The Fragment names are displayed in row #5. I use one column per variation per fragment. If one fragment has 3 variations, there will be three columns and I will merge together the fragment name cells. The fact that some cells are merged can be a problem when copy-paste to the stats table (as I would like to get rid of the merging).

2. # of samples corresponds to the number of cells in blue in column A. The number of samples can change from one report to another but is always constant in the same report.

3. # of failed sequences. In the table, I type "Failed Sequence" (if the analysis has failed) and "Missing Sequence" (if the analysis has not been done). When a sample is failed or missing, it is for the who fragment, no matter how many variation there is in the fragment, so I usually merge the cells of all variations for this failed sample.

4. % of success: this is quite easy #sample/#of failed+missing sequence for this fragment

5. # of variation is equal to the number of variations for this fragment (can be 0, 1, 2, etc.). When there is no variation in a fragment, I put '-- in all cells of the corresponding fragment on the "gene name" tab. Fragment 3 on my file is an example of 0 variation.

View 3 Replies View Related

Excel 2010 :: Create Sheet With Table From Pivot Table?

Apr 26, 2012

Recently, the boss showed me a Pivot table & chart, which consists of a list of about 30 user names in the first column. The row headings were the different items they purchased from a vending machine. & when he clicked on any name in the first column, this created a new sheet, renamed with users name, with a small table of results showing what that person purchased.

Problem is, none of us can figure out how to do this. I have created a new Pivot table & chart exactly like the original, but I cannot get the smaller sheet to generate. (Excel 2010)

View 3 Replies View Related







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