Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

URLDownloadToFile

Forumthread: URLDownloadToFile

URLDownloadToFile
24.11.2007 15:27:45
deni
Hello to all .... as many others I search for an answer... and the question is?

Sub URLDOWN()
Const strUrl As String = "http://www.xxxxxxxxxx.yyy.  _
_
txt"
Dim strSavePath As String
Dim returnValue As Long
strSavePath = ThisWorkbook.Path & "\" & "xxxx.txt"
returnValue = URLDownloadToFile(0, strUrl, strSavePath, 0, 0)
If returnValue = 0 Then
MsgBox "xxxx downloaded OK!"
Else
MsgBox "Tray again or exit"
End If
End Sub


Sometime my connection is to slow so I need 10 or more minutes...or page is down...and because of that I want to insert macro------OnTime like 15 sec Exit Sub...
So on 15 sec exit sub..
And now if i have problems I must use Task Manager to end Excel proc. because Esc , Ctrl-c Ctrl-Break do not function.
Many thanx

Anzeige

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: URLDownloadToFile
24.11.2007 18:47:08
Renee
Hi Deni,
Because EXCEL is not a mutlithreading application, I cannot see any easy way, then to kill it as you do now.
An idea, would be to start an 'external' killer-process via the shell, which looks out for the interval of 15 minutes for the existence of an external 'sync'-file. As soon the file is created it will delete it and exit.
If the file is not created within the intervall, it will kill (any) running Excel-Application. Your macro must write that file in case of success to stop the 'killer'.
GreetZ Renee

Anzeige
AW: URLDownloadToFile
24.11.2007 22:03:00
deni
Thanks for answer .....Is there way to check the file size and if size = 0 exit sub or to check if file or url is correct if no exit sub

AW: URLDownloadToFile
24.11.2007 22:29:00
deni
What about WebRequest and GetResponse is there a way to see if page is alive...Thanx

AW: URLDownloadToFile
25.11.2007 10:59:58
Renee
Hi Deni,
To your first question: Rather to check the file size, I would suggest to test for the existence of the file. I.e. Create the file (content is irrelevant) after successfull return from the Webquery and test for existence in the 'killer-process' and deletion of file and process itself.
To answer your second question you have to wait for other experts. My knowledge is close to nothing in that area. Therefor I leave your question opened.
GreetZ Renee

Anzeige
AW: URLDownloadToFile
25.11.2007 14:17:00
deni
Thank you for your time and your answer...many regards to you ....
Thanx
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige