开发者

Launching winword with a file using ActiveX

开发者 https://www.devze.com 2023-03-09 09:28 出处:网络
How can I launch Word with a document path from activeX like for example: function RunWord(cmdline, args){

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

精彩评论

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