function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
XactAndyXactAndy 

Opening Word documents using an s-control/Javascript

Hi,

We have a requirement to be able to open a Word document from
within a salesforce app using an activex control.

We have tried the following in an s-control:

var w=new ActiveXObject('Word.Application');

but get the error:

Automation server can't create object

Does anyone know how we can fix this, or have any other suggestions?!

Thanks,

Andy
werewolfwerewolf
Browser security generally disallows running random ActiveX controls like that.  If you really want to do it that way, you have to Tools -> Internet Options… -> Security tab -> click Custom level -> scroll to 'Run ActiveX controls and plug-ins' -> select ‘prompt’ or ‘enable’.  Then you'll have to add the Salesforce.com domain (or your domain or both) to the domains to which the Custom level applies.

However, if you are writing this for customers then you definitely don't want to do that.  Can you maybe just launch a new window with the document that kicks off MSWORD?  If it's stored as an Attachment or Document you can set the MIME type, and that will cause it to kick off Word pretty reliably when you redirect to the document.  You may even be able to embed that in an Iframe the way people sometimes do with PDFs.