Home > Blockchain >  Trying to copy the text of a web page into Excel
Trying to copy the text of a web page into Excel

Time:01-14

I am using this code to open Edge so that I can grab the text of the web page. I can get Edge to open and display the page, and I can copy the text of the page manually and then finish executing the code and it pastes it as needed, but I'm not at the skill level to figure out how to make Excel copy the text. It's the last step that I need.

Any help would be greatly appreciated.

I'm looking to copy the entire page, and not just one section of it.

Sub LOADEdge()
    Set obj = CreateObject("Shell.Application")
    obj.ShellExecute "microsoft-edge:https://maps.googleapis.com/maps/api/directions/json?origin=Disneyland&destination=Universal Studios HOllywood&key=your_API_Key"
   
    'This is where I manually grab the text from the page.
    MsgBox "wiating"
    
    Worksheets("sheet1").Range("A1").PasteSpecial Page = xlpagevalues
    
End Sub

I've tried to research how to copy web pages but most require Selenium to be installed and I can't get my IT department to do that for me. I've found work arounds on how to open the browser but I can't find anything that shows me how to copy the text of the page other than:

IE.ExecWB 17, 0 '// SelectAll
IE.ExecWB 12, 2 '// Copy selection

but that doesn't work.

CodePudding user response:

enter image description here

  • Related