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
indepUserindepUser 

Create a custom button to export an enquiry into an excel format - having issues with ActiveX

 

 

From: David Bellew [mailto:dbellew@salesforce.com]
Sent: 01 March 2010 07:44
To: priyank.garg@advancevalves.com
Subject: Case #03344005: Unable to use ActiveX in a custom button [ ref:00D062.50037rpye:ref ]

 

Dear Priyank,

Unfortunately code development is not supported by the Technical Support Team.

It is recommended that users visit the Developers forum for assistance in such issues.

http://developer.force.com

Best regards,
David Bellew
salesforce.com

Want to tell us about your support experience?

You may be sent a customer satisfaction survey in a few days, please complete this as we value your feedback.

------ Your Question/Comment ------

Hi,

I am trying to create a custom button which will execute JavaScript. In the Javascript code I am using ActiveX to read/write files on the user's desktop. I am trying this out from IE8. However, the button is giving me an error: "A problem with the OnClick JavaScript for this button or link was encountered: Automation server can't create object".

Can you please help how I can get this to work?

Basically, I am trying to provide the client with a functionality to generate a document from his opportunity.

Thanks!

NBlasgenNBlasgen
Have the custom button load an external URL (even a visualforce page if needed) and then have that page load whatever tools you need.   You can also then have that window close itself automaticly.
indepUserindepUser

Hi,

 

Thanks for the response. I was able to get the ActiveX stuff to work by relaxing the security settings on my IE. However, I am having trouble using the salesforce fields in my Javascript. Here is the code I am using:

 

var xls = new ActiveXObject("Excel.Application");
xls.visible = true;
xls.Workbooks.Add;
xls.Cells( 1, 1).Value = "Opportunity Number";
xls.Cells( 1, 2).Value = "{!Opportunity.Opportunity_Number__c}";
xls.Cells( 2, 1).Value = "Opportunity Name";
xls.Cells( 2, 2).Value = "{!Opportunity.Name}";

 

I am not able to get the opportunity number and name to come up correctly.

What am I doing wrong here???

 

Thanks!