Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Unable extract data from WEB query

I want to extract data from web. I have written a codes which is opening
CORRECTLY web site and passing login ID and Password. The page is moved to
anoher page where i pass required date (from date and to date) on submit IE
is providing required data correctly.

How these data can be extracted (downloaded / imported) into excel... When I
run the macro it imports data pertaining to Login page instead of actual data
which is appearing on IE.

Please help me out.

My codes are as under;

You may not able to access the site mentioned therein due to private domain.

Dim ie As Object
On Error GoTo 1
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate "http://10.6.4.48/institution/Login.jsp"
Do While .busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
With .Document.Forms(0)
.UID.Value = "GANESSR" 'Change to YOUR Login ID
.Pass.Value = "GANESSR" 'Change to YOUR password
.submit.Click
End With
' Do While Not CBool(InStrB(1, .Document.URL, "index.php"))
' DoEvents: Loop
' Call ShowWindow(.Hwnd, 3) 'Maximize
.Visible = True
Date = Format$(Now(), "MM/DD/YYYY")
' Date = Date - 4
.navigate "http://10.6.4.48/institution/TransactionReport.jsp"
With .Document.Forms(0)
.txtFromDt.Value = Date
.txtToDt.Value = Date
.submit.Click
End With
End With

Exit Sub


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://10.6.4.48/institution/TransactionReport.jsp",
Destination:=Range( _
"A1"))
' .Name = "TransactionReport"
.Name = "AllEntries"

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
' .WebTables = x
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With


1: MsgBox "Unexpected Error, sorry."
ie.Quit
Set ie = Nothing

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Unable extract data from WEB query

You need to add a wait after submitting the login form.

Tim


"Vijay Kotian" wrote in message
...
I want to extract data from web. I have written a codes which is opening
CORRECTLY web site and passing login ID and Password. The page is moved
to
anoher page where i pass required date (from date and to date) on submit
IE
is providing required data correctly.

How these data can be extracted (downloaded / imported) into excel... When
I
run the macro it imports data pertaining to Login page instead of actual
data
which is appearing on IE.

Please help me out.

My codes are as under;

You may not able to access the site mentioned therein due to private
domain.

Dim ie As Object
On Error GoTo 1
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate "http://10.6.4.48/institution/Login.jsp"
Do While .busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
With .Document.Forms(0)
.UID.Value = "GANESSR" 'Change to YOUR Login ID
.Pass.Value = "GANESSR" 'Change to YOUR password
.submit.Click
End With
' Do While Not CBool(InStrB(1, .Document.URL, "index.php"))
' DoEvents: Loop
' Call ShowWindow(.Hwnd, 3) 'Maximize
.Visible = True
Date = Format$(Now(), "MM/DD/YYYY")
' Date = Date - 4
.navigate "http://10.6.4.48/institution/TransactionReport.jsp"
With .Document.Forms(0)
.txtFromDt.Value = Date
.txtToDt.Value = Date
.submit.Click
End With
End With

Exit Sub


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://10.6.4.48/institution/TransactionReport.jsp",
Destination:=Range( _
"A1"))
' .Name = "TransactionReport"
.Name = "AllEntries"

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
' .WebTables = x
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With


1: MsgBox "Unexpected Error, sorry."
ie.Quit
Set ie = Nothing



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Unable extract data from WEB query

Hi Tim,

Thank you for your reply.

I have tried executing each command sequentially still final out put is same
( login page). What is surprising to me is with the code given below it
opens up new IE and with my last query (With
ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://10.6.4.48/institution/TransactionReport.jsp",
Destination:=Range( _
"A1"))


it starts quering from login page instead of report available in IE.

Can you please change codes if required to get required output.

Thank you.

"Tim Williams" wrote:

You need to add a wait after submitting the login form.

Tim


"Vijay Kotian" wrote in message
...
I want to extract data from web. I have written a codes which is opening
CORRECTLY web site and passing login ID and Password. The page is moved
to
anoher page where i pass required date (from date and to date) on submit
IE
is providing required data correctly.

How these data can be extracted (downloaded / imported) into excel... When
I
run the macro it imports data pertaining to Login page instead of actual
data
which is appearing on IE.

Please help me out.

My codes are as under;

You may not able to access the site mentioned therein due to private
domain.

Dim ie As Object
On Error GoTo 1
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate "http://10.6.4.48/institution/Login.jsp"
Do While .busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
With .Document.Forms(0)
.UID.Value = "GANESSR" 'Change to YOUR Login ID
.Pass.Value = "GANESSR" 'Change to YOUR password
.submit.Click
End With
' Do While Not CBool(InStrB(1, .Document.URL, "index.php"))
' DoEvents: Loop
' Call ShowWindow(.Hwnd, 3) 'Maximize
.Visible = True
Date = Format$(Now(), "MM/DD/YYYY")
' Date = Date - 4
.navigate "http://10.6.4.48/institution/TransactionReport.jsp"
With .Document.Forms(0)
.txtFromDt.Value = Date
.txtToDt.Value = Date
.submit.Click
End With
End With

Exit Sub


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://10.6.4.48/institution/TransactionReport.jsp",
Destination:=Range( _
"A1"))
' .Name = "TransactionReport"
.Name = "AllEntries"

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
' .WebTables = x
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With


1: MsgBox "Unexpected Error, sorry."
ie.Quit
Set ie = Nothing




Reply
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
Web query..... unable to get data ? Vijay Kotian Excel Discussion (Misc queries) 2 April 17th 09 02:00 PM
Extract Data using Web query [email protected] Excel Programming 5 December 16th 06 08:56 AM
Data extract from access query TrevorM Excel Discussion (Misc queries) 4 September 23rd 05 09:29 AM
Unable to open MSN stock quote query in get external data in Exce jermussen Excel Programming 1 July 29th 05 03:37 AM
Using Microsoft Query to Extract Data Jim Wallace Excel Programming 1 October 20th 03 11:30 PM


All times are GMT +1. The time now is 05:58 PM.

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"