Hi Sergey,
Do you know the difference between this method and Shellexecute?
BTW, I guess it should be "I should have explained from the beginning".
>Hi Sergio,
>
>I guess I should explain from the beginning that file name with spaces has to be included in quotes.
>You're correct that it works similar to double-click on a file.
>
>>
>>Hi Sergey,
>>I don't understand why he needs these extra pair of quotes ?
>>
>>
>>lcFileName = "C:\test.xls"
>>oShell = CREATEOBJECT('WScript.Shell')
>>oShell.Run(lcFileName)
>>
>>
>>Will work just fine. It could be that OP created problem at first place by
>>doing typo like
>>
>>
>>MYFILE = "C:\MY FILE\TEST.XLS"
>>lcFileName = [MFILE]
>>
>>
>>BTW Thank you very much for this answers because it answered for me
>>few long unanswered questions; How to open TIF file with MSOV and also how to open XPS file with XPS viewer.
>>
>>Well this WScript.Shell call answers them both :)
>>And was so simple.
>>
>>
>>
>>lcFileName = 'C:\test.tif'
>>oShell = CREATEOBJECT('WScript.Shell')
>>oShell.Run(lcFileName)
>>
>>
>>Works for both :)
>>
>>
>>I am guessing that running this shell call is the same as doing dbl-click
>>on any file which consecutively opens file with app associated with file extension.
>>Or I am wrong ?
>>
If it's not broken, fix it until it is.
My Blog