Access 2003 IE Object model renders webpage differently the Access 2007 IE object

Posted on 2013-10-05
Medium Priority
Last Modified: 2013-10-06
Trying to extract a company name from a web page,  using Access 2003 vba.
but when using Access 2007the ie object returns different data?

here is my vba code
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
 strHTML = ie.Document.body.innerHTML

HERE IS THE VIEW SOURCE from the webpage
                           <TABLE BORDER="0">
                                 <TD WIDTH="25" STYLE="font-size:2pt">&nbsp;</TD>
                                 <TD WIDTH="25" CLASS="c1">&nbsp;</TD>

                                 <TD ALIGN="RIGHT" CLASS="c0" VALIGN="TOP" NOWRAP>Company Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>

                                 <TD CLASS="c2">AMART CONSULTANT NETWORK INC</TD>

                                 <TD WIDTH="25" CLASS="c1">&nbsp;</TD>

                                 <TD ALIGN="RIGHT" CLASS="c0" NOWRAP>CRK:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>

strHTML result from Microsoft Office Access 2003

Company Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD class=c2>AMART CONSULTANT NETWORK INC</TD></TR><TR><TD class=c1 width=25>&nbsp;</TD><TD class=c0 noWrap align=right>CRK:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD class=c2>0001000000</TD></T

 strHTML result from Microsoft Office Access2007
Company Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

                                 <td class="c2"><span class="adtext" id="adtext_4">AMART</span> <span class="adtext" id="adtext_1">CONSULTANT NETWORK</span> INC</td>
my question is why do I get different results in Access 2003 and Access 2007?
how can I make them both work as in Access 2003?
Question by:durick
  • 3
  • 2
LVL 41

Accepted Solution

als315 earned 2000 total points
ID: 39550291
I think problem with different content could be in web server: it can analyse browser used and change code dynamically.
You can exclude this influence by removing tags from result. Look at sample (Query2)
2 functions are used:
removeTags removes any tags from string
GetSection return string with text after section name (second parameter)

Author Closing Comment

ID: 39550687
Thanks, these are two great functions. How would I modify "removeTags" to keep "<BR>" tags?
LVL 41

Expert Comment

ID: 39550848
You can see line in the beginning of function:
A = Replace(A, "</TR>", vbCrLf)
add similar line for <BR>:
A = Replace(A, "<BR>", vbCrLf)
or (and)
A = Replace(A, "</BR>", vbCrLf)

Author Comment

ID: 39550851
thanks again

Author Comment

ID: 39550856
Thanks again you have been so helpful, but now I have one more question.

The get section routine appears to work great in a query, but when I use it in straight  vba, the string value returned has many leading blanks or some characters that the trim function will not remove? any ideas

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Audit trails are very important in any system to hold people responsible for certain transactions and hold them to take ownership of their actions. This article is dedicated to all novice "Microsoft Access" developers.
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

600 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