Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTA Html Application load VBScript from .VBS file error: SUB not defin

Status
Not open for further replies.

johnlopez2000

Programmer
Aug 2, 2002
90
US
Colleagues,

I am attempting to load a script file at runtime into an HTA application. Works fine when the code is local in the HTA, but I want to have it is a seperate file:

//-----------------------------
test.hta content:
//-----------------------------
Code:
<html>

 <head>
 </head>
 
 <script type="VBScript" src="C:\temp\test.vbs"></script>
 
<body>
<textarea name="ScriptArea1" rows=5 cols=40></textarea><P>
<P><input type="button" value="Refresh Status" name="Test"  onClick="TestSub"><p><P>
</body>

</html>

//-----------------------------
test.vbs content:
//-----------------------------
Code:
    dim xFile

    xFile = "c:\tmp\chat.txt"

    Sub TestSub        
        ScriptArea1.value = vbNewLine & readFile(xFile)
    end sub
    
    function readFile(xfile)
    
      Const ForReading = 1
        
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFile = objFSO.OpenTextFile(xfile, ForReading)
      
      strText = objFile.ReadAll
      objFile.Close
      
      readFile = strText
    
    end function

Thanks very much for your help.



John Lopez
Enterprise PDM Architect
john.l.lopez@goodrich.com
 
><script type="VBScript" src="C:\temp\test.vbs"></script>
[tt]<script type="[red]text/[/red]VBScript" src="C:\temp\test.vbs"></script>[/tt]
 
tsuji - Thanks - that worked!

John Lopez
Enterprise PDM Architect
john.l.lopez@goodrich.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top