You can post form variables to a web query in order to automatically login to a page and retrieve its data. You need to know the name of the form variables required by the page. This information can be obtained by right cliking of the page that requires the information and chossing to "View Source". The names of the form variables that are required to be posted are the values of the "name" attributes for the elements within the "form" tag.
The following VBA code shows how to login into this forum and access this post:
Sub Login_WebQuery() Dim MyPost As String Const MyUrl As String = "http://www.business-spreadsheets.com/forum.asp?t=103" Const PostUser As String = "login=User Name" '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