LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Web query problem when password required

Hi, a i have code (see bellow) with web query but the page required login.
the page is http://www.hockeyarena.net/hokej.php and all i need is to connect
and import one table but login doesn't work. I can't figure out why? Maybe it
is because of wrong form number but i have tryid other numbers and it didn't
help. Any sugestion how solve this problem will be appreciated. Thanks

Henrich

- - -

Public Declare Function ShowWindow& Lib "user32" _
(ByVal hwnd As Long, ByVal nCmdShow As Integer)
Sub Trening()
Dim ie As Object
On Error GoTo 1
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Navigate "http://www.hockeyarena.net/hokej.php"
Do While .Busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
With .Document.forms(8)
.UserName.Value = "xxx"
.Password.Value = "xxx"
.login.Click
End With
Do While Not CBool(InStrB(1, .Document.URL, "index.php"))
DoEvents: Loop
Call ShowWindow(.hwnd, 3) 'Maximize
.Visible = True
End With
Set ie = Nothing

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.hockeyarena.net/manager_training_form1.php",
Destination:= _
Range("A1"))
.Name = "manager_training_form1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Exit Sub
1: MsgBox "Unexpected Error, sorry."
ie.Quit
Set ie = Nothing
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password required in VBA to open the sheet Tia[_3_] Excel Worksheet Functions 2 October 12th 08 11:41 AM
how do i change the message in the password required box Paul Excel Discussion (Misc queries) 1 January 30th 07 03:40 PM
When importing query from code - password required but not directl NJP Excel Programming 0 October 27th 06 03:59 PM
Excel 2000 required username and password login for database query ISTech Setting up and Configuration of Excel 0 September 7th 05 01:11 AM
Required multiple user name and password logins for database query ISTech Excel Discussion (Misc queries) 0 August 22nd 05 09:53 PM


All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"