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 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,