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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open file

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I use VBS to automatically open files in our system.

I have used it in the past and it works well. I now need to launch an html file.

Here is the code I am using.

Dim Fn,Fn1,FSO,s
dim sQuote
dim scriptName : scriptName=WScript.ScriptName
sQuote = chr(34)
Fn=Left(scriptName, Len(scriptName)-4)&".html"
Set FSO = CreateObject("Scripting.FileSystemObject")
s=FSO.GetAbsolutePathName(".")
s=s & "\TOUR\"
s=s & Fn
Fn1 =sQuote & s & sQuote
'MsgBox Fn1
'Wscript.Echo "File "&Fn1
Set sh= CreateObject("WScript.Shell")
returnVal = sh.run ((Fn1))

So..the code reads the vbs file name and the file location. It then computes the path to the file. The MsgBox Fn1 shows the correct path. I am having problems with the statements below the MsgBox. I have commented out the 'Wscript.Echo "File "&Fn1
because it was used for another job. I think my problem is located in the returnVal = sh.run ((Fn1)) statement.

Can anyone help?...is there an easier way to do this?

Thanks,
 
I have my answer. So please ignore this question. I don't know how to delet the thread.

thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top