Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scanning text out of html 1

Status
Not open for further replies.

alreadyinuse3000

Technical User
May 29, 2008
7
DE
hi there,

i have a small code, which helps me to access a website.
now i only want the internet explorer to copy a word from the text and save it into a variable.

the code so far:

Sub scanner()

myUrl = "Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Navigate myUrl
Do: Loop Until IEApp.Busy = False
Do: Loop Until IEApp.Busy = False
IEApp.Visible = True

IEApp.Document.all.Search.Value = "testword"

SendKeys "{TAB}}", True

' ??? well, and exactely this word should be copied to a variable


End Sub


Does anybody know he vba-statement?

Many thanks
 
alreadyinuse3000,
Here are a couple of ideas. thread707-1258272

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
oh great!!!

a dictionary example ... that's exacly what i was looking for.


Kind regards
AIU3000
 
but i think, what i am looking for is easier to achieve, since i i only need the statement that copies the whole screen into excel.

it's the same, as when i visit a page, press "mark everything/ mark all" and copy it into excel

does anybody know the vba-statement to reasize that?

thanks
 
alreadyinuse3000,
So you want all words from the text not a word from the text, easy enough
Code:
IEApp.Document.Body.innerText

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
yes exactly, but the text is dispersed over tables and I just want to copy the whole thing into excel and there I already know how to scan through the cells and look for the right entry.

thanks for your help, even though this statement was already given in the post ... I must be honest, that I have no experience in programming with IE (I was surprised, when I heard that it is possible)
 
alreadyinuse3000,
So it sounds like you want to paste into Excel with all the formatting? You can do it with the API's listed in the other post and [tt]Worksheet.PasteSpecial[/tt].

If your just trying to pull information from Web Tables this post might be of interest thread707-1458220.

CMP
 
hi there,

thanks for your reply.
My code is the following and I am pretty sure, that I am right in front of the goal.

...but for now, it still doesnt work?

He opens the website, enters the word correctly, sends the keys, and again opens the appropriate site ... but then: unfortunately there occurs this German failure message which I can only translate by its meaning:

"try, to revoke a drop-target, that has not been registered"

Even with Do: Loop Until IEApp.busy = False after the send keys ... it doesn't work???



Here is my code:

Sub scanner()

myUrl = "Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Navigate myUrl
Do: Loop Until IEApp.busy = False
Do: Loop Until IEApp.busy = False
IEApp.Visible = True

IEApp.Document.All.Search.Value = "je"

SendKeys "{TAB} + {Enter} + {Enter}", True

' Do: Loop Until IEApp.busy = False

IEApp.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT

ActiveSheet.PasteSpecial

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top