Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Actuate
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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 JavaDownload Now!
  #1  
Old September 14th, 2003, 07:07 AM
donbmjr donbmjr is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 10 donbmjr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 32 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old September 15th, 2003, 12:00 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
Access web pages in the some interval??..

Reply With Quote
  #3  
Old September 15th, 2003, 12:42 PM
donbmjr donbmjr is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 10 donbmjr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 32 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old September 15th, 2003, 11:45 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
U can Use the MS Internet transfer contorl to get the web Header or all of the web,And Parse the web content!...

Reply With Quote
  #5  
Old September 16th, 2003, 11:11 AM
donbmjr donbmjr is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 10 donbmjr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 32 sec
Reputation Power: 0
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

Reply With Quote
  #6  
Old September 16th, 2003, 10:10 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Web Query help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway