View Full Version : I don't want IE to open excep

08-12-2007, 10:03 AM

I have an Excel document that runs macros and that will be hosted on a web site so that multiple users can access and run the file. In the site I have a link the users click on to open the file.

When I click on the link, Excel is automatically open in Internet Explorer. I notice that when the file is opened in IE, I get multiple errors in the macros. I realize that the Excel plug-in for IE may not be able to run my macros and so I don't want IE to open the file.

I did some research and I found out that I can change the configuration of my computers to prevent IE to open excel files. However, this is not a good solution because I would have to force many users to change settings in their individual computers they may not familiar with or may not have privileges to change. I then found a VBScript on-line that would prevent IE to open the Excel file but I had some problems with it:

Dim objExcel

Sub btnOpen_onclick()
Dim path
path = "C:\myfile.xls"
call OpenWorkbook(path)
End Sub

Sub OpenWorkbook(strLocation)
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = true
objExcel.Workbooks.Open strLocation
objExcel.UserControl = true
End Sub

<TITLE>Launch Excel</Title>

When I run this script from c:\ it works perfectly. However, when I upload this html file to my website and try to open the excel file I get the following error:
Error: ActiveX component can't create object: 'Excel.Application'

The error happens here: Set objExcel = CreateObject("Excel.Application")

Thanks in advance for your help

08-14-2007, 08:42 AM
Well, I'm not 100% sure of this but I don't think asp can run application on the client machine. Imagine you enter a site and boom it open 99999 and more Word Application:S. that would be a major security flaw.

There are lot of things you can do locally but not on web script because of security.

So I guess the solution is to let the user download the file then open it locally.

08-16-2007, 07:10 AM
Thanks for your replay. It makes sense. It is just frustrading to have your users change their computers settings for something that should not be the way it is in the first place. If IE opens Excel then it should support everything Excel does!