LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 1
Default Simplest way to parse (read) HTML formatted data in via Excel VBA (or VB6)


"Steve" wrote in message
...
I distributed some workbook apps in 2001 that are

currently being used
for budgeting and forecasting work. A main feature of

the apps is the
ability to pull current-year data from the

proprietary accounting software
that the businesses use. The users were able to run a

general ledger
trial balance, save it in plain text format, and my

apps would parse the
data and import it into the workbooks.

Well, now their accounting software has been updated

to export the
reports into html format, not plain text.


A lot of accounting software these days will export to
XML
format. See if maybe that is an option. If so you can
use
MSXML to easily parse the XML.

If not, and you are stuck with HTML, the first thing I
would
do is find the <Table...</Table section and strip it
out.
Then I would scan through the remainder, and count the
number of rows, at the same time I would count the max
number of columns. This is easily done by counting the
<TR
tags for rows, and each time you see a <TR count the
number of <TD or <TH tags that show up before the
next </TR. Only keep track of the max number of
columns.

Then redim an array as myArray(0 to numCols - 1, 0 to
numRows - 1)
Now read throught the data again, and start at row 0,
col 0. Each time
you hit a new </TD or </TH tag increment the col
pointer.
Each time you hit a </TR tag increment the row
pointer. Read the
data between each tag in the corresponding
myArray(curCol, curRow).

There are probably easier ways to do this. But this is
just
the method that first came to mind.

Andrew Faust


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop excel from processing HTML? IE paste raw html. nick Excel Discussion (Misc queries) 2 April 21st 23 05:12 PM
What is the simplest IPC from Excel VBA to a .NET app? John Brock Excel Discussion (Misc queries) 5 November 9th 09 10:59 PM
Generate html Tags from Excel formatted text Bikram Excel Discussion (Misc queries) 0 February 24th 09 07:05 AM
Parse row data in Excel [email protected] Excel Discussion (Misc queries) 0 April 3rd 08 08:53 PM
What's the simplest way to copy data from another workbook JohnT Excel Worksheet Functions 0 January 16th 05 01:19 AM


All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"