Opening files on the web

Posted on 2003-03-02
Medium Priority
Last Modified: 2010-05-01

I have a program that uses a data file that I would like to be updatable from the web. I don't want the user to have to use an internet browser, but to be able to click a button and the file is downloaded onto there computer.

Or something like:

Open "http://www.address.com/file.dat" For Output as #1

That code wouldnt work but how could it be changed to work?

Question by:chrispadbury
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Expert Comment

ID: 8054290
'You need to place a command button (Command1) and an inet control (Inet1) on your form.
'The user will also need an active internet connection.
Private Sub Command1_Click()
Dim strMyData as String
Inet1.URL = "http://www.address.com/file.dat"
Inet1.Password = ""
Inet1.UserName = ""
strMyData = Inet1.OpenURL
Open ("C:\TheFilePath" & "\file.dat") For Binary Access Write As #1
Put #1, , strMyData
Close #1
End Sub

Expert Comment

ID: 8054294
P.S. I'm assuming your datafile is ascii (text).

Author Comment

ID: 8056333
That's Great it works a treat. Is there some code to check that the internet is connected and if not to prompt the user to connect (like you get when you open a web browser).


Accepted Solution

J-Man earned 200 total points
ID: 8083437
I'm glad it works.  I'd appreciate it if you would click the "Accept this answer" button so I get credit for it.  As an added incentive, I'll answer your other question for no extra points.

Here is a short working example of determining if an internet connection exists.


Note: I'm not sure if this can tell the difference between an internet connection and an active LAN connection.  You might need to experiment.  Also, MSDN (msdn.microsoft.com) might have more info on the InternetAttemptConnect function in the wininet library.
Also, replace the msgbox by calling the dialup connection if you want it to connect automatically.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question