I want to open a log file **(test.log)** present in my local machine in the **(C: drive** location **)** using VB script function say **"LogGen"**. This log file should open onClick of the HTML button named **Log** as in below code, upon clicking the button, the VB script function"LogGen" should be called and executed. 

```
<input type="button" name="Log" id="Start" value="  Login  " onclick="LogGen">

```

I am new to VB scripts. Can someone suggest me some sample code for the Vb script function to fetch the log file present in the local directory?

---

**NEW PROBLEM CODE**

---

```
Sub LogOpen()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, MyFile, FileName, TextLine
Set fso = CreateObject("Scripting.FileSystemObject")
' Open the file for output.
FileName = "c:\\testfile.txt"
  Set MyFile = fso.OpenTextFile(FileName, ForWriting, True, TristateTrue)
' Open the file for input.
 Set MyFile = fso.OpenTextFile(FileName, ForReading)
' Read from the file and display the results.
 Do While MyFile.AtEndOfStream <> True
     TextLine = MyFile.ReadLine
     Document.Write TextLine & "<br />"
 Loop
'MyFile.Close
End Sub

```

I did the one as shown above and called this subroutine in a button event called "Log" but it doesn't work. **A blank screen with yz typed on it appears** and it occupies the entire window and then application has to be closed. **Can you please suggest where is the mistake.** I want the logfile in C directory to pop out on click of the Log button but this is not happening.

```
<input type="button" name="Log" value="Log" onclick="LogOpen"><br/>

```