Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ID and access currently active web page (in IE6)?
I googled, but no joy. Using Excel 2003. I have other code I've used to navigate, open, and parse web pages- but all from within Excel, it never popped up in IE. However, now I need to parse a page that I can't open directly from Excel (I have to enter a screen-based code to go from page to page). So, I'd like to be able to manually navigate in IE, then run my macro to scrape the key elements from the IE web page and bring them into my target worksheet range. Can anyone help me with the syntax to point Excel to the currently active IE page? Thank you, Keith |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ID and access currently active web page (in IE6)?
Sounds like you have to login with a username and password. See this sample code (I got it from this DG a short time ago): Sub Login() 'This gets rid of the duplicate data Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True HomeURL = "http://www.countrybobsdemo.com/administrator/" 'get web page IE.Navigate2 HomeURL Do While IE.readyState < 4 DoEvents Loop Do While IE.busy = True DoEvents Loop Set Form = IE.document.getelementsbytagname("Form") Set NameBox = IE.document.getElementById("modlgn_username") 'check if already login If Not NameBox Is Nothing Then NameBox.Value = "Ryan" Set PasswordBox = IE.document.getElementById("modlgn_passwd") PasswordBox.Value = "ryan123" Form(0).submit Do While IE.busy = True DoEvents Loop End If URL = "index.php?option=com_rsform&task=submissions.mana ge&formId=2" 'get web page IE.Navigate2 HomeURL & URL Do While IE.readyState < 4 DoEvents Loop Do While IE.busy = True DoEvents Loop Set Mytables = IE.document.getelementsbytagname("table") Set History = Mytables(2) RowCount = 1 For Each itm In History.Rows ColCount = 1 For Each Col In itm.Cells Select Case Col.Children.Length Case 0, 1, 2 Cells(RowCount, ColCount) = Col.innertext Case Is = 3 Cells(RowCount, ColCount) = Col.Children(1).innertext End Select ColCount = ColCount + 1 Next Col RowCount = RowCount + 1 Next itm End Sub HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "ker_01" wrote: I googled, but no joy. Using Excel 2003. I have other code I've used to navigate, open, and parse web pages- but all from within Excel, it never popped up in IE. However, now I need to parse a page that I can't open directly from Excel (I have to enter a screen-based code to go from page to page). So, I'd like to be able to manually navigate in IE, then run my macro to scrape the key elements from the IE web page and bring them into my target worksheet range. Can anyone help me with the syntax to point Excel to the currently active IE page? Thank you, Keith |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
ID and access currently active web page (in IE6)?
On Jul 6, 12:50*pm, ker_01 wrote:
I googled, but no joy. Using Excel 2003. I have other code I've used to navigate, open, and parse web pages- but all from within Excel, it never popped up in IE. However, now I need to parse a page that I can't open directly from Excel (I have to enter a screen-based code to go from page to page). So, I'd like to be able to manually navigate in IE, then run my macro to scrape the key elements from the IE web page and bring them into my target worksheet range. Can anyone help me with the syntax to point Excel to the currently active IE page? Thank you, Keith Keith...You should be able to accomplish this programmatically using an input box to manually enter the screen-based code. What url do you start with and where do you want to wind up?..Ron |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
ID and access currently active web page (in IE6)?
The full sequence of events is that I access the target URL, login, make some
selections that forwards me to a second (secure) website; then I go through about 4 screens to set up various search parameters and get my results. The website has built-in security that prevents copy/paste of screen contents, so I need to use Regex against the page source to grab the data I need. In addition, to go from page to page, I have to enter/type a visual code for security purposes. I'm totally fine with the login process, and it is complex enough that I'd hate to have to try to do it (text entry, combobox selections, etc) via code and sendkeys. So, I get to the point where I already have an instance of IE6 open (not opened from Excel) and the problem I have is that I don't know how to get Excel to find the instance of IE6 and capture the page code, since the process wasn't started in Excel. I'm thinking something like: Dim MyBrowser as InternetExplorer6.Instance Set MyBrowser = InternetExplorer.activewindow Dim currentpage as string currentpage = MyBrowser.source 'then use regex to parse out the key data I appreciate any assistance or code snippets! Thank you, Keith "ron" wrote: On Jul 6, 12:50 pm, ker_01 wrote: I googled, but no joy. Using Excel 2003. I have other code I've used to navigate, open, and parse web pages- but all from within Excel, it never popped up in IE. However, now I need to parse a page that I can't open directly from Excel (I have to enter a screen-based code to go from page to page). So, I'd like to be able to manually navigate in IE, then run my macro to scrape the key elements from the IE web page and bring them into my target worksheet range. Can anyone help me with the syntax to point Excel to the currently active IE page? Thank you, Keith Keith...You should be able to accomplish this programmatically using an input box to manually enter the screen-based code. What url do you start with and where do you want to wind up?..Ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to access VBA variable from active worksheet | Excel Programming | |||
Access current active workbook from DLL | Excel Programming | |||
Access to Active X code names | Excel Programming | |||
VBA access to Active X Scroll Bar | Excel Programming | |||
which page is active | Excel Programming |