Forum Discussion

Esternbach's avatar
Esternbach
Copper Contributor
Mar 06, 2023

Insert Hyperlink Into Cell from Website Using a Macro

Hi,

 

I'm looking to use a macro to essentially get and/or refresh specific data items and also the unique user URL into Excel from a website that requires a password to first login.  

 

Any help would be much appreciated!

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    Esternbach 

    Untested, fresh from the internet,

        You would still have to customize it to your liking.

     

    Sub ueberwachen()
    DoEvents
    On Error Resume Next
    Dim IEApp As Object
    Dim IEDocument As Object
    Dim i As Long
    Dim alt As String
    Dim neu As String
    Set IEApp = CreateObject("InternetExplorer.Application")
    IEApp.Visible = False
    IEApp.Navigate Range("A1").Hyperlinks(1).Address
    Start = Now
    Do: Loop Until IEApp.Busy = False
    Do: Loop Until IEApp.Busy = False
    Do
    If DateDiff("s", Start, Now) > 30 Then Exit Do
    Loop Until IEApp.ReadyState 4
    Set IEDocument = IEApp.Document
    Debug.Print IEDocument.body.innertext
    ActiveSheet.Range("A2") = IEDocument.body.innertext
    Set IEDocument = Nothing
    Set IEApp = Nothing
    End Sub
    -------------------------------------------
    second code
    
    Sub Webauslesen()
    Dim Internet As Object
    Set Internet = CreateObject("InternetExplorer.Application")
    Internet.Navigate [a1]
    Do While Not Internet.ReadyState = 4
    Loop
    Internet.Visible = True
    Internet.execwb 17, 0
    Internet.execwb 12, 0
    Internet.execwb 18, 0
    Do While Not Internet.ReadyState = 4
    Loop
    Internet.Quit
    Set Internet = Nothing
    Tabelle1.Paste
    End Sub

     

    Haven't tried both codes, just fished them out from the internet 🙂

     

Resources