Using internet browser via VBA macro

Solved
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

  1. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    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...
    0
    1. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      edit2 : for the 2nd example :
      - right-click on the data in Sheet1,
      - 'edit data'
      - check the box at the top left to retrieve the entire page (it is no longer possible to only retrieve the desired data block)
      Of course, the desired data has changed its location on Sheet1

      eric
      0
    2. tchernosplif Posted messages 714 Status Member 249
       
      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
      0
  2. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    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
    0
    1. tchernosplif Posted messages 714 Status Member 249
       
      I understood my mistake; if I copy the cell directly, Ctrl+V doesn’t work, but if I copy the URL in the formula bar, then Ctrl+V works.

      Strangely, I get the HTML code of the page; I’ve tried checking/unchecking all the layout options...
      0
    2. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      Normally you should have:
      - either nothing: no yellow arrow is checkable on the web page
      - or only the text (choose 'no formatting')

      Send your link (in pm if you prefer) if you want me to take a look...
      0
    3. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      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
      0
    4. tchernosplif Posted messages 714 Status Member 249
       
      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 ^^
      0