Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My code is reading a file before it's saved

Status
Not open for further replies.

RoyVidar

Instructor
Jun 16, 2000
6,606
NO
I'm downloading a text file, using the Shell function and FTP program in a Form_Timer event (<A HREF="ftp://FTP.TXT" TARGET="_new">FTP.TXT</A> contains username, PW, and Get). <br><br>retval = Shell(&quot;c:\windows\system\<A HREF="ftp://ftp.exe" TARGET="_new">ftp.exe</A> -s:<A HREF="ftp://ftp.txt" TARGET="_new">ftp.txt</A> <A HREF=" TARGET="_new"> vbHide)<br><br>My problem is that the code continues to run, so that the processing of the textfile (import) starts before the file is actually saved to disk. The returnvalue of the Shell function is received before the data is actually saved.<br><br>I've made a simple routine holding the execution for some seconds, but that will at some time fail.<br><br>I'd appreciate any help preventing the app from reading the file unless it's properly saved. Thanks.
 
Use the WinINet API to control the FTP process yourself.&nbsp;&nbsp;This will have the major advantage that if it goes wrong, you'll know about it before you try to open a file that isn't there.<br><br>You can get more info on the API from the MSDN web site.&nbsp;&nbsp;Go to <br><br><A HREF=" TARGET="_new"> use the &quot;Search MSDN&quot; to look for WinINet API.&nbsp;&nbsp;Bear in mind that some of the functions will only work if IE5 is installed, so be careful.<br><br>Hope this helps. <p> Jonathan<br><a href=mailto:j.w.george@virginnet.co.uk>j.w.george@virginnet.co.uk</a><br><a href= > </a><br>Working with: Visual Basic 6, Access 97, Visual Interdev 6, VBScript, Active Server Pages, SQL Server 6.5, Oracle 7
 
Sounds great, but in this area I'm a complete novise, I've previously tried the MS Internet Controls, but got the &quot;No license&quot;-msg. I also used some time browsing through the URL, but got the impression it was all related to VC/VB - are they available through VBA? Vould you, ore someone perhaps have some code-snippets to share?<br><br>Thanks, Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top