Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
H Marsil,
You can try this basic code (you need to add references to Microsoft HTML Object Library and Microsoft Internet Controls):
Dim IE As New InternetExplorer
Dim str As String, i As Long, j As Long
Dim Doc As HTMLDocument
Dim tagElements As Object
Dim element As HTMLObjectElement
i = 2
j = 2
Do Until ActiveSheet.Cells(j, 1) = ""
str = ActiveSheet.Cells(j, 1)
IE.navigate str
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Set Doc = IE.document
Set tagElements = Doc.all.tags("a")
For Each element In tagElements
ActiveSheet.Cells(i, 3) = str
ActiveSheet.Cells(i, 4) = element.href
i = i + 1
Next element
j = j + 1
Loop
IE.Quit
End Sub
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
Just sending the file without saying what the problem is, is not at all useful. It's like saying "Houston, we have a problem..."
The code works, read again the instructions. Once you add the references, will work. If you don't know how to add a reference, go to visual basic editor-Tools-References and browse for those 2 libraries mentioned.
Catalin Bombea said
you need to add references to Microsoft HTML Object Library and Microsoft Internet Controls):
1 Guest(s)