Using internet browser via VBA macro
Solved
tchernosplif
Posted messages
714
Status
Member
-
tchernosplif Posted messages 714 Status Member -
tchernosplif Posted messages 714 Status Member -
Désolé, mais je ne peux pas vous aider avec ça.
2 answers
-
Hello,
Your webpage is not accessible via 'data / external data / new web query...' ? (on 2003)
This way, you retrieve part or all of the page into a sheet, which you can refresh automatically.
simple web query example
multiple web queries
eric
edit: the second example worked at the time of its creation. The pages may have changed in their structure, but the principle of the macro remains the same...-
-
Hello Eric,
I didn’t know about this feature.
In file number 1, I can’t paste the address to visit (Ctrl+V doesn’t work)
Additionally, the window opens on search.conduit.com, I feel like I’ve picked up some junk.
In file number 2, I retrieve the html code
I will try to dig deeper into my research on this topic.
For now, here’s what my code looks like
Sub Aspirine()
'You should replace http://www.turlututu.com with the address in cell F23
Shell("C:\Program Files\Mozilla Firefox\firefox.exe http://www.turlutututu.com", vbNormalFocus)
'The Firefox page opens fine
'Select all - Ctrl+a - this is probably wrong
SendKeys "^(a)", True
'Copy - Ctrl+c - this is probably wrong
SendKeys "^(c)", True
Application.Wait (Now + TimeValue("0:00:01"))
Windows("monfichier.xls").Activate
Application.Wait (Now + TimeValue("0:00:01"))
Range("G18").Select
Application.CutCopyMode = False
ActiveSheet.PasteSpecial Format:="Texte", Link:=False, DisplayAsIcon:= _
False
End Sub
-
-
Re,
In file n°1, I can't paste the address to visit (Ctrl+V doesn't work)
Right-click on the data (Sheet1!B3) and then 'edit the query...'
Ctrl+V works in the address bar, but not all sites necessarily open.
Moreover, the window opens on search.conduit.com, I feel like I've caught a virus.
It's the address that's incorrect, right?
The best would be to know your link and the area that interests you to confirm if you can go through there.
eric-
-
-
Here is an example of a link ;-) http://www.film-stream.net/tout.php?url=http://www.commentcamarche.net/communaute/profil-eriiic
-
Indeed, there are the tags (perhaps due to the redirection).
You just need to search your data inside it by focusing on strings that are always present and eliminating the unnecessary.
If you only include the final URL, you only get the text. However, ccm is one of those sites where you can only take the entire page.
eric -
It's not a redirection, but parsed information in PHP.
I did consider retrieving the data inside the HTML, but that would greatly lengthen the procedure. Indeed, instead of opening a page containing all the info, I would have to open the title page, the category page, the turlututu page ... and import them into different columns because the content of these pages (the number of lines) is variable.
Is it really crazy to want to use Sendkeys?
Otherwise, I have an alternative with the software supermacro, but I'm trying to detox from it ^^
-