tags:

views:

76

answers:

2

I have an HTML file C:\Program Files\my_html_files\file.html. How do I open this file using VBScript? (By "open" I mean open it with the default application, as if it was double-clicked in Explorer.)

A: 

You can use the File System Object like this:

Set FSO=CreateObject("Scripting.FileSystemObject")
Set iFile = FSO.OpenTextFile ("C:\Program Files\my_html_files\file.html")
Data = iFile.ReadAll
MsgBox(Data)
iFile.Close
Sarfraz
It not goodI need the action as double click on the file.htmlYour script not display the real file.html
lidia
+1  A: 

Do you mean open the file in Internet Explorer?

Dim objIE
'' Create an IE object
Set objIE = CreateObject("InternetExplorer.Application")
'' Open file
objIE.Navigate "C:\Program Files\my_html_files\file.html"
Remou