Link to home
Start Free TrialLog in
Avatar of kbay808
kbay808Flag for United States of America

asked on

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)
(Title)                
(Machine name)
(Alt ticket number)
(Description)
(Journal Updates)
(POC Name)
(POC Phone Number)
(Location Code)
(Related Ticket Number)

Link to previous question
https://www.experts-exchange.com/questions/28600768/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.html
Debug-File--Sanitized-.docx
IE-Pull-Data.1.Debug.xlsm
Avatar of Norie
Norie

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.
Avatar of kbay808

ASKER

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.
kbay808,

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.
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.
ASKER CERTIFIED SOLUTION
Avatar of ltlbearand3
ltlbearand3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@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.
Avatar of kbay808

ASKER

@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