Nu er jeg kommet en del videre med det, med hjælp fra http://www.dailydoseofexcel.com/archives/2011/03/08/get-data-from-website-that-requires-a-login/ - http://www.dailydoseofexcel.com/archives/2011/03/08/get-data-from-website-that-requires-a-login/ Jeg har dog et problem, da der ingen Tabel ID er på denne side. Kan jeg sætte hele siden ind på nogen måde?
Sub GetTable() Dim ieApp As InternetExplorer Dim ieDoc As Object Dim ieTable As Object Dim clip As DataObject 'create a new instance of ie Set ieApp = New InternetExplorer 'you don’t need this, but it’s good for debugging ieApp.Visible = True 'assume we’re not logged in and just go directly to the login page ieApp.navigate "http://www.installationsblanket.dk/Logon.asp" Do While ieApp.Busy: DoEvents: Loop Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop Set ieDoc = ieApp.document 'fill in the login form – View Source from your browser to get the control names With ieDoc.forms(0) .Brugernavn.Value = "***" .Adgangskode.Value = "***" .submit End With Do While ieApp.Busy: DoEvents: Loop Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop 'now that we’re in, go to the page we want ieApp.navigate "http://www.installationsblanket.dk/selskab/600.asp" Do While ieApp.Busy: DoEvents: Loop Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop 'get the table based on the table’s id Set ieDoc = ieApp.document Set ieTable = ieDoc.all.Item("Bottom") 'copy the tables html to the clipboard and paste to teh sheet If Not ieTable Is Nothing Then Set clip = New DataObject clip.SetText "<html>" & MieTable.outerHTML & "</html>" clip.PutInClipboard Sheet1.Select Sheet1.Range("A1").Select Sheet1.PasteSpecial "Unicode Text" End If 'close 'er up ieApp.Quit Set ieApp = Nothing End Sub
|