|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Avoid common pitfalls of incorporating spreadsheets into Java apps. Read about it in the free white paper: “Five Biggest Blunders when Building Spreadsheet Applications in Java” Download Now! |
|
#1
|
|||
|
|||
|
Web Query help
Hi
Each week I have 4 web query's to a company site, the address for the query changes each week with a different number ie data/ 3468. Of course I have the new number for the page before hand, but the time of the post is not on a rigid schedule making it anoying to keep doing the query every 15min or so and getting the error message, file not found. Is it possible to put in code to query every 10 min or so after the initial query is started until the query has been sucessful, I also notice that if you do the same query without clearing the first it puts the data next to it, also a problem. Excel 2002 Thanks Don |
|
#2
|
|||
|
|||
|
Access web pages in the some interval??..
|
|
#3
|
|||
|
|||
|
An interval would be nice
An interval would be nice
every 10 to 15 min or so without an error coming up, like unable to find this page, They are always NEW pages Thanks Don |
|
#4
|
|||
|
|||
|
U can Use the MS Internet transfer contorl to get the web Header or all of the web,And Parse the web content!...
|
|
#5
|
|||
|
|||
|
You might as well have....
You might as well have asked me to write the code for a new Windows XP
New to Excel, I can do many things on the computer Web design, Adobe photoshop,Macromedia Flash charts, trouble shoot XP problems etc, plus being a full time fitness trainer and golf instructor. There are only so many hours in the day and far to many programs to learn and at 61 there are many fewer days to leran them I was hope was for a little code Thanks Don |
|
#6
|
|||
|
|||
|
Now, donbmjr! There is a sample code for U!
Hoping it is useful! 'downloads an (binary)file over the HTTP-protocol and saves it to a file.. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _ lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long) 'used for direct memory copy Const Timeout As Long = 60 'Timeout, if no connection can be established (in seconds) Dim file() As Byte, Destination As String 'Byte-Array containing current file-contents; Destination file on the harddisk Dim LastSizeCheck As Long, LastSize As Long 'Data needed for speed-status Private Sub btnStartDL_Click() Inet1.RequestTimeout = Timeout 'set timeout ProgressBar1.Max = 1024 '--- here you must fill in the expected file size (in KBs), for using the progressbar... Destination = App.Path & "\vb6sp4-runtime.exe" 'set destination file Label1.Caption = "Establishing connection..." Inet1.Execute "http://www.ssgf.at/docs/haupt.htm", "GET" 'Start the download of the specified file End Sub 'Determines the UBound of the "file"-Array. If the Array is "Empty" ("Erase file"), it returns -1 Private Function SafeUBoundFile() As Long On Error GoTo erro SafeUBoundFile = UBound(file) Exit Function erro: SafeUBoundFile = -1 End Function Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Inet1.Cancel 'cancel on exit End Sub Private Sub INet1_StateChanged(ByVal State As Integer) Static inProc As Boolean If Not inProc Then 'only execute this procedure, if it is the first call (DoEvents in this sub may call this event frequently inProc = True Debug.Print Timer, State Select Case State Case icResponseReceived 'Received something Dim vtData() As Byte 'Current Chunk Label1.Caption = "Downloading " & Inet1.URL & "..." Do While Inet1.StillExecuting DoEvents Loop Do DoEvents vtData = Inet1.GetChunk(256, 1) If UBound(vtData) = -1 Then Exit Do 'exit loop, if no Chunk could received ReDim Preserve file(SafeUBoundFile + UBound(vtData) + 1) 'enlarge file-array CopyMemory file(UBound(file) - UBound(vtData)), vtData(0), UBound(vtData) + 1 'copy received Chunk to the file-array If UBound(vtData) <> 255 Then Exit Do 'if the length of the chunk is not 255, then it must be the last chunk of the file Dim tmp As Long tmp = UBound(file) / 1024 If tmp > ProgressBar1.Max Then tmp = ProgressBar1.Max 'if KBs is higher then ProgressBar1.Maxy then truncated ProgressBar1.Value = tmp 'update ProgressBar1 Loop Label1.Caption = "Download complete." MsgBox "Download complete." Inet1.Cancel Open Destination For Binary As #1 'Write file-array to destination-file Put #1, , file Close #1 Erase file 'free file-array End Select inProc = False End If End Sub 'Updates the status. Think about it.... Private Sub Timer1_Timer() Label2.Caption = Format(SafeUBoundFile / 1024, "#,##0.00 KB") & " @ " & _ Format((SafeUBoundFile - LastSize) / 1024 / (Timer - LastSizeCheck / 1000), "#,##0.00 KB/s") LastSizeCheck = Timer * 1000 LastSize = SafeUBoundFile End Sub |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Web Query help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|