How to download text file by passing variables?

Posted on 2003-03-05
Medium Priority
Last Modified: 2010-05-01
I'm not sure of the termenology, but this is what I'd like to do...

If I type

into my browser, the username and password I supply is sent to the server and then the appropriate text file is displayed in the browser.

I'd like to download this file using VB. I have tried using the Inet control, but it doesn't seem to send the variables correctly. All i get is a text file that contains text similar to "bad login or password" - which seems to indicate that the username and password is not being "passed" to the server.

If anyone knows of a method I could use I'd be very grateful.

Many thanks.
Question by:cmjacques
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
LVL 14

Accepted Solution

aelatik earned 720 total points
ID: 8071158
Private Sub Form_Load()
GetHTMLCode ("https://myaccount.somesite.com/stats.txt?login=<username>&passwd=<password>")
End Sub

Public Function GetHTMLCode(URL As String)
  Dim IE
  Set IE = CreateObject("InternetExplorer.Application")
      IE.Navigate URL
      While IE.Busy
         GetHTMLCode = IE.Document.documentelement.innerHTML
  MsgBox GetHTMLCode
End Function
LVL 11

Expert Comment

ID: 8071567
you could embed the username and the password in the URL itself.


Could this be the reason for getting login error?

Author Comment

ID: 8071825
Thanks very much aelatik!

Your solution worked perfectly.

Here are some points for you.


Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

765 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