Button on HTML calling VB function

Posted on 2004-11-24
Last Modified: 2010-04-01

Have a button calling a vb function on the click event.
I'd like to pass the filepath/filename into the function using file input type button..
How do I do this?
Question by:skellyc
    LVL 14

    Expert Comment

    <Script Language=VBScript>

    function readFile (file)
    on error resume next
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    vText = ""
    'input text file
    Set objTF = objFSO.OpenTextFile(file)

        do while not objTF.AtEndofStream
         vText = vText & objTF.Readline

    Set objTF = nothing
    Set objFSO = nothing
    end function

    sub read_OnClick()
    testform.fileholder.value=readfile( testform.testfile.value)
    end sub


    <form name=testform>
    <input type=file name=testfile >&nbsp;&nbsp; <INPUT type=button value=read name=read></P>
    <P> <INPUT style="WIDTH:
     511px; HEIGHT: 173px" size=1443 name=fileholder rows="100"
    cols="100" readonly width="44" vspace=44>

    LVL 14

    Accepted Solution

    I have already posted the same in ur previous thread

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now