[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


VB 6.0 webbrowser control to automate File Input Value

Posted on 2005-05-11
Medium Priority
Last Modified: 2013-12-25
I do have a webbrowser control in my VB form, while I have a file type input in my webpage. I already know the physical location of my file, and I would like the software to auto fill them.

Here is the html coding

<table V5DOTBL=true border="1">
<tr valign="top"><td width="144" bgcolor="#FF9FA9"><div align="right"><a href="javascript:alert('Click the browse button to select each file you wish to attach to this message.  You may send two attachments per message.')"><b><i><font size="2" face="Times New Roman">Attachment:</font></i></b></a></div></td><td width="555" bgcolor="#FF9FA9"><font size=-1>
<input type="file" name="%%File.48256d1000036f9a.02b1bfacb55094b448256d3b002b99d2.$Body.9.19C2">
<input type="file" name="%%File.48256d1000036f9a.02b1bfacb55094b448256d3b002b99d2.$Body.9.19E4"></font>

I tried the VB coding

Private Sub Command2_Click()
        WebBrowser1.Document.Forms(0).Elements("%%File.48256d1000036f9a.02b1bfacb55094b448256d3b002b99d2.$Body.9.19C2").Value = "C:\test.html"
End Sub

But seems like the value never been updated.
Please have a try on the test webpage

I visited this page but still couldn't get the clue.
Question by:cybeh
  • 2
  • 2
LVL 10

Expert Comment

ID: 13984187
Hi, cybeh.

I've had no success either.  Per the following EE posts, it's apparently not possible to do this for security reasons:


Microsoft's page regarding Input File types:


Author Comment

ID: 13986688
em....Seems like i need to request the user to add the file in manually......:(

Author Comment

ID: 13986733
oh...or is there any possible way that, I already set focus to the input box, and make a simulation like the string is typing in by the keyboard? Hope you get what I mean. If that is possible, may i know how?
Since the file location might be very long, it might be troublesome for the user to type in. So, as long as the user set a focus on the input box, by click on a button, the "C:\test.html" will be auto apear.

LVL 10

Accepted Solution

edwardiii earned 1500 total points
ID: 13990247
If we could set a value to the input file element, this might be possible.  But to my knowledge there is no way to do this.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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 (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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 Month20 days, left to enroll

873 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