Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Get data from browser

Hi,

I'm looking for code to grab data from a browser window that is currently open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible only after logging in and other clicks. I use Office XP and Windows XP SP2.

Thanks,
Vivek
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Get data from browser

Google this group for "IE automation"

Tim

"Vivek" wrote in message
...
Hi,

I'm looking for code to grab data from a browser window that is currently
open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible
only after logging in and other clicks. I use Office XP and Windows XP SP2.

Thanks,
Vivek


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Get data from browser

Tim,

Tried your tip but could not find any usable posts. Can you point to any specific post in your knowledge that deals with code for trying to grab data from IE. That would be very useful for me. This is only for one-time personal use :)

Thanks,
Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message ...
Google this group for "IE automation"

Tim

"Vivek" wrote in message
...
Hi,

I'm looking for code to grab data from a browser window that is currently
open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible
only after logging in and other clicks. I use Office XP and Windows XP SP2.

Thanks,
Vivek


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Get data from browser

Without knowing exactly what info you need to extract from the page it's
difficult to offer anything concrete, but something like this would get you
started:

Sub Tester()

dim oDoc
set oDoc = GetIE(http://www.somesite.com/)

if not oDoc is nothing then

'do something with oDoc
msgbox oDoc.body.innerHTML

else
msgbox "not found"
end if

End Sub

'Find an open IE window with matching location and
' return a reference to the document object
Function GetIE(sAddress As String) As Object

Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String


Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.document.Location
On Error GoTo 0
If sURL < "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.document
Exit For
End If
End If
Next o

Set GetIE = retVal
End Function

Tim



"Vivek" wrote in message
...
Tim,

Tried your tip but could not find any usable posts. Can you point to any
specific post in your knowledge that deals with code for trying to grab data
from IE. That would be very useful for me. This is only for one-time
personal use :)

Thanks,
Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Google this group for "IE automation"

Tim

"Vivek" wrote in message
...
Hi,

I'm looking for code to grab data from a browser window that is currently
open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible
only after logging in and other clicks. I use Office XP and Windows XP
SP2.

Thanks,
Vivek




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Get data from browser

Thanks Tim.

When i put your code in a module the "set oDoc=" line appears in red. Running the macro results in a syntax error on that line. What could be going wrong here and how can I fix it?

I'm looking to extract a table from the website - similar to what a web query does from within Excel.

Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message ...
Without knowing exactly what info you need to extract from the page it's
difficult to offer anything concrete, but something like this would get you
started:

Sub Tester()

dim oDoc
set oDoc = GetIE(http://www.somesite.com/)

if not oDoc is nothing then

'do something with oDoc
msgbox oDoc.body.innerHTML

else
msgbox "not found"
end if

End Sub

'Find an open IE window with matching location and
' return a reference to the document object
Function GetIE(sAddress As String) As Object

Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String


Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.document.Location
On Error GoTo 0
If sURL < "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.document
Exit For
End If
End If
Next o

Set GetIE = retVal
End Function

Tim



"Vivek" wrote in message
...
Tim,

Tried your tip but could not find any usable posts. Can you point to any
specific post in your knowledge that deals with code for trying to grab data
from IE. That would be very useful for me. This is only for one-time
personal use :)

Thanks,
Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Google this group for "IE automation"

Tim

"Vivek" wrote in message
...
Hi,

I'm looking for code to grab data from a browser window that is currently
open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible
only after logging in and other clicks. I use Office XP and Windows XP
SP2.

Thanks,
Vivek






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Get data from browser

Post the code exactly as you have entered it in Excel.

Tim


"Vivek" wrote in message
...
Thanks Tim.

When i put your code in a module the "set oDoc=" line appears in red.
Running the macro results in a syntax error on that line. What could be
going wrong here and how can I fix it?

I'm looking to extract a table from the website - similar to what a web
query does from within Excel.

Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Without knowing exactly what info you need to extract from the page it's
difficult to offer anything concrete, but something like this would get
you
started:

Sub Tester()

dim oDoc
set oDoc = GetIE(http://www.somesite.com/)

if not oDoc is nothing then

'do something with oDoc
msgbox oDoc.body.innerHTML

else
msgbox "not found"
end if

End Sub

'Find an open IE window with matching location and
' return a reference to the document object
Function GetIE(sAddress As String) As Object

Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String


Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.document.Location
On Error GoTo 0
If sURL < "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.document
Exit For
End If
End If
Next o

Set GetIE = retVal
End Function

Tim



"Vivek" wrote in message
...
Tim,

Tried your tip but could not find any usable posts. Can you point to any
specific post in your knowledge that deals with code for trying to grab
data
from IE. That would be very useful for me. This is only for one-time
personal use :)

Thanks,
Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Google this group for "IE automation"

Tim

"Vivek" wrote in
message
...
Hi,

I'm looking for code to grab data from a browser window that is currently
open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible
only after logging in and other clicks. I use Office XP and Windows XP
SP2.

Thanks,
Vivek






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get data from browser

Try putting the argument in quotes and see if that helps...

set oDoc = GetIE("http://www.somesite.com/")

Rick


"Vivek" wrote in message
...
Thanks Tim.

When i put your code in a module the "set oDoc=" line appears in red.
Running the macro results in a syntax error on that line. What could be
going wrong here and how can I fix it?

I'm looking to extract a table from the website - similar to what a web
query does from within Excel.

Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Without knowing exactly what info you need to extract from the page it's
difficult to offer anything concrete, but something like this would get
you
started:

Sub Tester()

dim oDoc
set oDoc = GetIE(http://www.somesite.com/)

if not oDoc is nothing then

'do something with oDoc
msgbox oDoc.body.innerHTML

else
msgbox "not found"
end if

End Sub

'Find an open IE window with matching location and
' return a reference to the document object
Function GetIE(sAddress As String) As Object

Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String


Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.document.Location
On Error GoTo 0
If sURL < "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.document
Exit For
End If
End If
Next o

Set GetIE = retVal
End Function

Tim



"Vivek" wrote in message
...
Tim,

Tried your tip but could not find any usable posts. Can you point to any
specific post in your knowledge that deals with code for trying to grab
data
from IE. That would be very useful for me. This is only for one-time
personal use :)

Thanks,
Vivek

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Google this group for "IE automation"

Tim

"Vivek" wrote in
message
...
Hi,

I'm looking for code to grab data from a browser window that is currently
open. The browser title will be fixed.
I don't prefer the web query option as the data in question is accessible
only after logging in and other clicks. I use Office XP and Windows XP
SP2.

Thanks,
Vivek





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 get Excel to grab data from browser? grove Excel Programming 2 April 8th 08 02:58 PM
Passing Data to Internet Browser SyrNO Excel Programming 5 July 12th 06 08:22 AM
Moving Data from a Web Browser to Excel JohnHill Excel Discussion (Misc queries) 0 April 27th 06 04:06 AM
need help sorting data in browser [email protected] Excel Programming 0 March 7th 05 09:41 PM
display in memory data in browser window Erin[_4_] Excel Programming 1 September 19th 03 04:11 PM


All times are GMT +1. The time now is 03:51 PM.

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

About Us

"It's about Microsoft Excel"