开发者

Launching winword with a file using ActiveX

How can I launch Word with a document path from activeX like for example:

function RunWord(cmdline, args){
var v;
v = new ActiveXObject("Shell.Application");
v.ShellExecute(cmdline+" "+args);
}

w开发者_运维问答here cmdline is 'Word' that is a shortcut link in one of the system folder and args is the path to file like 'C:\Projects\Schedule.doc'

The problem is it combine the string like 'Word C:\Projects\Schedule.doc' and then give an error saying it does not find this application, however when I launch word alone without args it works ok.

Any ideas ?


Do you need to escaped the backslashes in your filename? I.e. use

'C:\\Projects\\Schedule.doc'

instead of

'C:\Projects\Schedule.doc'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜