Greetings, I'm having some problems with my current VBA script in Excel. The goal is to get a table from a website with the QueryTables function. Well, works fine so far. But to access the data which I need, I have to login (username/password).
The login form runs with the POST method. Here is the current sourcecode Sub Test() Dim MyPost As String Const MyUrl As String = "http://some-url" '<<<<<<<< Change this URL. Const PostUser As String = "user=Username" 'Change user name here Const PostPassword As String = "&pass=Password" 'Change password here MyPost = PostUser & PostPassword With ActiveSheet.QueryTables.Add(Connection:= _ "URL;" & MyUrl, Destination:=Cells(1, 1)) .PostText = MyPost .BackgroundQuery = True .TablesOnlyFromHTML = True .Refresh BackgroundQuery:=False .SaveData = True End With End Sub Things you need to change to test this code: - URL: Just find a webpage with a login form, and copy the URL in the proper string. - Username-Field: Take a look at the sourcecode of the webpage. Look for the input fields name, and put it before the username - Password-Field: Same with username-field. Things I checked so far: - Correct name of the input boxes - Correct URL Now, why won't it just work? Do you guys have any ideas? PS: Running Vista and Excel 2007 -- pmw --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com -~----------~----~----~----~------~----~------~--~---