×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Overview on the Inet control

Overview on the Inet control

Overview on the Inet control

(OP)
I have a present project to download files from a website to my server. can anyone give me a simple code on how to do this using the INet control.

thanks.

RE: Overview on the Inet control

TLiberty,

Here is some code that I came up with after wrestling with this one for a while myself. This code is actually getting the filenames from an array, but you can change it any way you like to meet your needs. Let me know if you have any questions or problems. Hope it helps. :)

'=============================
' CODE
'=============================
Private Sub GetFiles()
On Error GoTo errGetFiles
Dim x() As Byte, i As Integer

For i = 0 To UBound(aFileNames)
Inet1.URL = "http://www.myserver.com"; & aFileNames(i)
x = Inet1.OpenURL(, icByteArray)
Open "C:\" & aFileNames(i) For Binary Access Write As #1
Put #1, , x()
Close #1
Next i

exitGetFiles:
Exit Sub

errGetFiles:
Err.Raise 805, , "Error getting files from server"

End Sub

RE: Overview on the Inet control

(OP)
Thanks a million Kcronin

One more question, can I use this same routine to download and open a text file.

RE: Overview on the Inet control

Slightly off topic but... Kcronin - Did you happen to be the lead singer for REO Speedwagon? I bet you've heard that a 1000 times now huh? Opps, I mean 1000 and 1.

Steve Meier
sdmeier@jcn1.com

RE: Overview on the Inet control

TLiberty,

Well, in the code, you can specify the exact path of the file you downloaded. If you know the file type, such as Word, and already know the file path, then you can create an instance of Word and open your document in it.

Hope this helps.

Kenneth W. Cronin, MCP
kcronin@atdsystems.com
ATD Systems Corporation

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close