How to create a vba code to extract a string of data from the “View Source” code from an active IE window into a cell in excel? Part 2

This is a continuation from a previous question.  I need to modify this code so that when there is only one record shown and it’s missing a frame the data will still populate.  I have attached a debug file that was generated by the “IE-Pull-Data.NoDebug” file that ltlbearand3 created.  The target data is listed in multiple places, but each occurrence is highlighted.

(Ticket Number)
(Machine name)
(Alt ticket number)
(Journal Updates)
(POC Name)
(POC Phone Number)
(Location Code)
(Related Ticket Number)

Link to previous question
Who is Participating?
Okay.  I think I have an idea.  Please run this file on both scenarios,  See if it works and post the debug file from each scenario.  Thanks.
NorieVBA ExpertCommented:
Are you trying to extract data from a webpage?

If you are there could be other (better?) ways to do it rather than looking at the source code.
kbay808Author Commented:
Yes I am trying to extract data from a website. The question is miss leading, because the solution from the first part extract the data in a different way.  Please view the debug file for the current code.
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.


I think Norie is trying to get you to think through the options that may exist for getting the data.  For example, might it be possible to set up a connection straight to the database (like via OLEDB or ODBC)?  Something to consider.

Going forward with having to extract from the website, i will take a look at the debug.  However, that is from Debug 11, could you post the debug from IE-Pull-Data.1.xlsm?  I would like to see a file from one that works and one from a ticket that does not work.  That may help in comparing the two to find a method to handle the missing frame.  I am digging through the one you did post to see what I can find right now.
NorieVBA ExpertCommented:
I was actually thinking more along the lines of XMLHTTP or automating IE.

Using either of those methods you would have access to the DOM of the web page which in turn gives you acces to all the elements on the page.
@Norie - the other thread is pretty long but we cannot use either of those options as we don't have access to the page through those methods.  The user must log in to the site and navigate to the specific information first.  Therefore we have to use the active IE window.  You can look at the other thread and see if Ron (IrogSinta) and I missed anything.
kbay808Author Commented:
@ltlbearand3 – Awesome Job!!!  You got this down pat now.  It worked perfect on the first try.  There is no need to modify the code.  I was able to figure out how to remove the debug portion with no problem.

I will be posting another question within the next couple of days that I hope that you can take a look at.  It’s the same thing, but for closed tickets.  It must be in a different iframe.   I will post the question after I get a chance to sanitize the debug files (for when there are multiple tickets and for when there is only 1 ticket).  I’ll send you a message with the link after I post it.

Thanks again
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.

All Courses

From novice to tech pro — start learning today.