Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default 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
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
How to access VBA variable from active worksheet Andrew[_56_] Excel Programming 1 May 23rd 09 09:50 AM
Access current active workbook from DLL hon123456 Excel Programming 1 September 8th 06 08:00 AM
Access to Active X code names [email protected] Excel Programming 0 March 9th 06 06:17 AM
VBA access to Active X Scroll Bar CodeJunky Excel Programming 2 December 20th 05 10:21 PM
which page is active JT Excel Programming 4 October 25th 05 03:56 PM


All times are GMT +1. The time now is 12:10 PM.

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

About Us

"It's about Microsoft Excel"